Hi,
I have been reading forums online for the past two days to try to find a solution to this problems.
I have 1 form with 4 subforms. Only the 'chosen' subform needs to be completed based on a drop down selection. I have that part working great. What I am having trouble with is adding a button to each subform to verify a list of up to 26 fields that are required. If not all 26 fields have been completed, a message comes up asking the user to complete the fields. If they are all completed, then an email box comes up and attaches the completed form (not just the subform) to the email.
I realize there are a lot of threads on this and I have tried several of them but cannot seem to get this working.
I have the following code in the Click event of the button and in JavaScrip language:
var RequiredFields = new Array(26);
RequiredFields[0]= "form1.EDER.EDER.CRFOR";
RequiredFields[1]="form1.EDER.EDER.VisitDate";
RequiredFields[2] ="form1.EDER.EDER.VisitTime";
RequiredFields[3] = "form1.EDER.EDER.MHNumb";
RequiredFields[4] ="form1.EDER.EDER.PHIN";
RequiredFields[5]= "form1.EDER.EDER.LastName";
RequiredFields[6] ="form1.EDER.EDER.FirstName";
RequiredFields[7] ="form1.EDER.EDER.Marital";
RequiredFields[8] ="form1.EDER.EDER.DOB";
RequiredFields[9] ="form1.EDER.EDER.ModeArrival";
RequiredFields[10] ="form1.EDER.EDER.Address";
RequiredFields[11] ="form1.EDER.EDER.CityTown";
RequiredFields[12] ="form1.EDER.EDER.Prov";
RequiredFields[13] ="form1.EDER.EDER.PostalCode";
RequiredFields[14]= "form1.EDER.EDER.PrimPhone";
RequiredFields[15] ="form1.EDER.EDER.CellPhone";
RequiredFields[16] ="form1.EDER.EDER.PrimCareProv";
RequiredFields[17] ="form1.EDER.EDER.HomeLang";
RequiredFields[18] ="form1.EDER.EDER.OffLang";
RequiredFields[19] ="form1.EDER.EDER.Interpreter";
RequiredFields[20] ="form1.EDER.EDER.Addressograph";
RequiredFields[21] ="form1.EDER.EDER.CTASlvl";
RequiredFields[22] ="form1.EDER.EDER.VisitRsn";
RequiredFields[23] ="form1.EDER.EDER.ERProv";
RequiredFields[24] ="form1.EDER.EDER.ARO";
RequiredFields[25] ="form1.EDER.EDER.NOK";
var AlertMsg = new Array(26);
AlertMsg[0] = "Please select the type of central registration.";
AlertMsg[1] = "Please indicate the Visit Date.";
AlertMsg[2] = "Please indicate the Visit Time.";
AlertMsg[3] = "Please indicate the MH Number.";
AlertMsg[4] = "Please indicate the PHIN.";
AlertMsg[5] = "Please indicate the Last Name.";
AlertMsg[6] = "Please indicate the First Name.";
AlertMsg[7] = "Please provide the marital status.";
AlertMsg[8] = "Please indicate the Date of Birth.";
AlertMsg[9] = "Please select the Mode of Arrival.";
AlertMsg[10] = "Please provide the address.";
AlertMsg[11] = "Please provide the City/Town.";
AlertMsg[12] = "Please provide the Province.";
AlertMsg[13] = "Please provide the Postal Code.";
AlertMsg[14] = "Please provide the Primary Phone Number.";
AlertMsg[15] = "Please provide the Cell Phone.";
AlertMsg[16] = "Please provide the Primary Care Provider.";
AlertMsg[17] = "Please provide the Home Language.";
AlertMsg[18] = "Please provide the Official Language.";
AlertMsg[19] = "Please indicate Interpreter needs.";
AlertMsg[20] = "Please indicate Addressograph needs.";
AlertMsg[21] = "Please indicate CTAS/triage level.";
AlertMsg[22] = "Please provide Visit reason.";
AlertMsg[23] = "Please provide Emergency Provider.";
AlertMsg[24] = "Please indicate ARO";
AlertMsg[25] = "Please provide Next of Kin.";
var if(bSuccess==true);
var emptyTest=/^\s*$/;
var fieldCount=RequiredFields.length;
var fld=0;
for(var i=0;i
My fields are as follows:
When I run the debugger in Adobe Pro, I get piles of syntax errors:
TypeError: f is null
3:Field:Calculate
TypeError: f is null
3:Field:Calculate
TypeError: f is null
3:Field:Calculate
TypeError: f is null
3:Field:Calculate
TypeError: f is null
3:Field:Calculate
SyntaxError: syntax error
3:XFA:form1[0]:EDER[0]:EDER[0]:Button1[0]:click
SyntaxError: syntax error
3:XFA:form1[0]:EDER[0]:EDER[0]:Button1[0]:click
SyntaxError: syntax error (THIS KEEPS ON until Line 58)
followed by this error
SyntaxError: missing variable name
57:XFA:form1[0]:EDER[0]:EDER[0]:Button1[0]:click
SyntaxError: missing variable name
Any help to clean up what is probably right in front of my nose would be great. I am relatively new at JavaScript.
Much appreciate the help!
Solved! Go to Solution.
Hi,
Have a look at this version, mainly a matter of changing the names in the script to match yours, but I have also moved it to the change event.
In the initialise event I've added the line "this.execEvent("change");" so the form displays none of the subforms when first opened. If you don't want that then remove the line.
LiveCycle designer uses your instance of Acrobat (or Reader whichever is your default) so the options in Acrobat have an affect.
Bruce
Views
Replies
Total Likes
Hi,
Further to all this work, I am now being asked if it is possible on one of the forms that if a certain text field is populated (MRN) that it would 'disable' the 'required' option on other text fields.
Is this something that I can do on the form itself that wouldn't mess up all the other code I (Bruce) has inserted to make only the visible form have their fields required?
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies