Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Form with submit button and required fields not working correctly!!! Any suggestions?

TWorthley
Level 2
Level 2

I have a form that I created in LiveCycle Designer ES2 . I have a submit button with an email address. I also have three fields that are required. I have put a short java script to have one of the fields data entered into the subject line. The problem I am having is that now that I have the code, I no longer am notified of the 'required' fields until AFTER the email is sent.  What have I done wrong?? I am not a programmer but do understand some script.

I found a script that notified the user of the required fields prior to the email box popping up, but now I have lost my subject line message involving one of the fields from the form. Of course I am under the gun from upper management to get this completed soon, so we can roll it out company wide.... any and all help would be greatly appreciated.

 

3 Replies
Niall_O_Donovan
Level 10
Level 10

Hi,

I suspect that the problem is with the javascript that you have added. Can you list the script and the event that you have placed it in?

Also have a look here http://assure.ly/eUR4wJ at some email solutions and see does that help.

Niall

TWorthley
Level 2
Level 2

I am pretty sure the answer is in the script. I have put together pieces of script from other suggestions and I am pretty sure I have ascrewed something up  along teh way. I have looked at the attached link and that is where I got some of the script you see below. I am sure you will refer to me as the hatchet person who chopped the script up. sorry. (It is in the Mouse Up) This does work, sort of...It will give the user the message that the required fields are not filed in if they are blank, but it will send the email, but without the custom message in the subject line.

if (employeename.rawValue != null || employeename.rawValue != "") {

vSubject  = "Form completed by " + employeename.rawValue;

vBody = "The form has been sent by " + employeename.rawValue;

}

if  (completedate.rawValue != null || completedate.rawValue != "") {

vBody   = vBody + " on " + completedate.rawValue;

}

if  (EmployeeID.rawValue != null || EmployeeID.rawValue != "") {

vBody = vBody + " Your ID is: " + EmployeeName.rawValue;

}

var oDoc = event.target;

oDoc.mailDoc({

     bUI: false, 

     cTo: "mail@mail.org",

     cSubject: "Statement from " + EmployeeName.rawValue + "

})

Niall_O_Donovan
Level 10
Level 10

Hi,

If I just give a generic script first:

var vEmail = "email@address.com";

var vSubject = "A Subject for your email";

var vBody =  "Put your body message here...";

event.target.app.mailMsg({

     bUI: true,

     cTo: vEmail,

     cSubject: vSubject,

     cMsg: vBody

});

In your script you are building the subject line string within the mailMsg script. I would be inclined to move this out to where you are declaring the variable. You also have +" after the EmployeeName.rawValue. This will cause the script to fail.

You are also checking field values and declaring variables for the subject and body, but don't seem to be using them.

Niall