Copy link to clipboard
Copied
I'm trying to set up a form where Dropdown1 is a list of police departments to choose from. I would like it to autopoluate the address of the department chosen into the next texbox of the form. I have created an export value (address) for each police department in Dropdown1. Where I run into issues is setting up the next field to accept the export value of the previous field. I have tried various scripts found in other posts but none seem to be working. I think I'm either missing a step or the others are not requesting exactly what I am looking for. I am a novice at scripts. Thanks!
Copy link to clipboard
Copied
Where did you use script?
If you are using script in the dropdown field, use it as 'calculate' script, not 'validate'.
Copy link to clipboard
Copied
So I was able to figure out how to populate the next field by adding the script to the address field. It tests successful. My next question, is there any way to populate a third field with a different set of criteria?
Copy link to clipboard
Copied
What I am tring to do is based on the selection of the police department, I would like Text3 to diplay their Vendor number. This is what I came up with for the text3 Custom Calculation Script but it's not generating the desired results:
var Dropdown1 = this.getField("Dropdown1").valusAsString;if (Dropdown1=="") event.value = "";else if (Dropdown1=="Any Police Department") event.value = "V001";else if (Dropdown1=="Some Police Department") event.value = "V002";else if (Dropdown1=="My Police Department") event.value = "V003";
I can't pinpoint where I'm going wrong.
Copy link to clipboard
Copied
The code seems fine, but make sure there are no error messages in the JS Console when you use it.
Also, you have to make sure the values you entered in the code match those in the drop-down EXACTLY, including upper/lower-case letters, spaces, etc. If the value is not "My Police Department" but "My police department" or "My Police Department" (with two spaces after Police), it won't match.