Copy link to clipboard
Copied
Hi all, I've seen this question asked (and answered in different ways) many times, but none of the answers provided seem to match what I'm looking to complete. I'm working in Acrobat Pro DC.
I think what I'm asking for is a simple validation script, but I can't seem to find the correct combination of code.
My form includes: Name (which is a dropdown box, pre-populated with names). When the Name is selected from the dropdown box, I would like the Email and Phone Number fields to also auto-populate.
Drop_Name: Peter Pan
Text_Email: [Removed by MOD]
Text_Phone: [Removed by MOD]
Also, one of the Name selections in Drop_Name is "Other". When "Other" is selected from the dropdown menu, the Text_Email and Text_Phone fields need to be free-form text fields (so the data can be manually populated). Is there a way to complete both asks with one code/script?
Hi,
Assuming your field names as are you mentioned, then yes you could have a validation script that goes something like:
var emailText = "";
var phoneText = "";
if ( event.value == "Peter Pan"){
emailText = "peter.pan@example.com";
phoneText = "+01010101001"
// just add the section again for each name you want.
} else if ( event.value == "Different name"){
emailText = "different.name@example.com";
phoneText = "+02020202020202";
}
// make sure the name in between the brackets matches your f
...
Copy link to clipboard
Copied
Hi,
Assuming your field names as are you mentioned, then yes you could have a validation script that goes something like:
var emailText = "";
var phoneText = "";
if ( event.value == "Peter Pan"){
emailText = "peter.pan@example.com";
phoneText = "+01010101001"
// just add the section again for each name you want.
} else if ( event.value == "Different name"){
emailText = "different.name@example.com";
phoneText = "+02020202020202";
}
// make sure the name in between the brackets matches your field names.
this.getField("Text_Email").value = emailText;
this.getField("Text_Phone").value = phoneText;
Copy link to clipboard
Copied
Works perfectly, thanks much!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi. I'm building a form.
It have 4 fields:
1. Text Field Name: Cost.
2. Text Field Name: Unit
3. Dropdown: Frequency
4. Total.
The dropdown have option as daily, weekly and anually. I want Total to be auto populated on the basis of dropdown selection and calculating at the same time.
Eg: Upon selecting daily, Total must auto calculate '(cost*unit)*365
Upon selecting weekly, total will be '(cost*unit)*52.
Please help