Copy link to clipboard
Copied
Hi there,
I have a dropdown that is built around the name of a store. In the values, I've added the address and phone number for each store, separated by a ";". I then use a custom script to calculate based on those parts.
However, in the event the store doesn't exist in the dropdown, I would like to have the calculated fields that show "address" and "phone number" to accept a manual entry. Currently, if I allow custom input into the store field, both the "address" and "phone number" fields render "undefined."
I currently have a blank item with no values as the default, but once custom text is entered, the other two calculated fields render "undefined."
For reference, here's how I've coded the "parts":
var clinparts = this.getField("ClinName").valueAsString.split(";");
var clinnamepart = String(clinparts[0]);
var clinaddpart = String(clinparts[1]);
var clinphpart = String(clinparts[2]);
event.value = clinaddpart;
Copy link to clipboard
Copied
A calculation script is performed each time the user clicks on any field in the document, and it "pulls" the data towards it.
You should use a Validation script or an "On blur" action script from the drop-down list to "push" the data to the text field.
Thus the data filled in the text field will not be overwritten by the calculation script.