Hello,
I have written the following script in the Actions/Mouse UP section for the 'Email PDF' button I created. When I click the button, I do not get any alert messages for empty required fields, nor do I get an email popup (which I had been able to get prior to deciding to add the required field validation).
Here is my javascript:
var RequiredFields = new Array(17);
RequiredFields[0] = "Adjustability Type";
RequiredFields[1] = "Workstation Type";
RequiredFields[2] = "Range Type";
RequiredFields[3] = "Capacity Type";
RequiredFields[4] = "Base Type";
RequiredFields[5] = "Quantity";
RequiredFields[6] = "Date";
RequiredFields[7] = "Contact Name";
RequiredFields[8] = "Company Name";
RequiredFields[9] = "Company Type";
RequiredFields[10] = "Address";
RequiredFields[11] = "Postal Code / ZIP";
RequiredFields[12] = "City";
RequiredFields[13] = "Province / State";
RequiredFields[14] = "Country";
RequiredFields[15] = "Phone";
RequiredFields[16] = "Email";
var AlertMsg = new Array(17);
AlertMsg[0] = "Please select the type of adjustability you want.";
AlertMsg[1] = "Please select the type of workstation you want.";
AlertMsg[2] = "Please select the amount of range you want.";
AlertMsg[3] = "Please select the amount of capacity you want.";
AlertMsg[4] = "Please select the base (legs) color you want.";
AlertMsg[5] = "Please indicate your estimated order quantity.";
AlertMsg[6] = "Please indicate the date you want your workstations.";
AlertMsg[7] = "Please provide a contact name.";
AlertMsg[8] = "Please provide your company name.";
AlertMsg[9] = "Please select your company type.";
AlertMsg[10] = "Please provide your company's address.";
AlertMsg[11] = "Please provide your company's postal/ZIP code.";
AlertMsg[12] = "Please provide your company's city.";
AlertMsg[13] = "Please provide your company's province/state.";
AlertMsg[14] = "Please provide your company's country.";
AlertMsg[15] = "Please provide the contact's phone #.";
AlertMsg[16] = "Please provide the contact's email address.";
var bSuccess=True
var emptyTest=/^\s*$/;
var fieldCount=RequiredFields.length
var fld=0;
for(var i=0;i
You might also want to consider using semicolons where they are missing and indenting the code so it's easier for us to read.
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script