Copy link to clipboard
Copied
I have a form that is requiring the user to fill in the Project Name field (Text56) ..
Example: Project 1, Project 2, Project 3
The Dropdown menus are then using the following code to set the menu items as the above project names..
event.target.setItems( this.getField("Text56").value.split(", "));
I need the user to be able to select one of these menu items per drop down field...
Example:
Monday_Dropdown1.0 = Project 1
Tuesday_Dropdown1.0 = Project 3
However, when Monday_Dropdown1.0 is set to Project 1 for example.... As soon as another dropdown box is selected.... the Monday field is reset to blank.
Is this something wrong with my code?
Could someone help urgently? I would really appreciate it.
Copy link to clipboard
Copied
You have to first remove all the calculation scripts you already added. The only script you should be using is under the text field's Validation event.
To apply the same values to multiple fields you can use something like this:
for (var i=0; i<=19; i++) {
if (event.value) {
this.getField("Monday_Dropdown1."+i).setItems(event.value.split(", "));
this.getField("Tuesday_Dropdown1."+i).setItems(event.value.split(", "));
// etc.
} else {
this.getField("Monday_Dropdown1."+i).clearItems();
this.getField("Tuesday_Dropdown1."+i).clearItems();
// etc.
}
}
Copy link to clipboard
Copied
> event.target.setItems( this.getField("Text56").value.split(", "));
Where does you this script?
Copy link to clipboard
Copied
It is entered into each dropdown field under 'Calculate' tab > Custom Calculation Script
Copy link to clipboard
Copied
A calculation script is executed each time the value of any field in the file is changed. That's why the value keeps resetting. You should move the code to the custom Validation script of the text field and adjust it accordingly.
Copy link to clipboard
Copied
Ahh, was awaiting a response from you! ha.
So is my code ok to just move to the Text56 field? or do I need to add additional information
Copy link to clipboard
Copied
You need to adjust it slightly. Try this:
if (event.value) this.getField("Tuesday_Dropdown1.0").setItems(event.value.split(", "));
else this.getField("Tuesday_Dropdown1.0").clearItems();
Copy link to clipboard
Copied
I tried that into the Text56 field and also the Tuesday Dropdown validation area separately but it doesn't seem to work. my menu options no longer pull through.
am I doing something wrong?
will I need to adjust it for each field name and enter into the validation area for each of these?
Copy link to clipboard
Copied
It only needs to be under the text field. Remove the Validation (and Calculation!) scripts from the drop-down.
If it still doesn't work share the file, please.
If you want each text field to populate a different drop-down then you'll need to duplicate the code, yes, or create a generic function (maybe taking the name of the target drop-down field as a parameter) and then call it from each text field.
Copy link to clipboard
Copied
So there will only be 1 text field in which user will enter multiple project names separated by space & a comma ( ,)
I need each of the dropdown fields to have the menu populated from this 1 text field and yes need each dropdown to have a different selection.
I have shared the or file for you to take a look
So I guess I would need to have a code that lists all the dropdown fields rather than just Tuesday
Copy link to clipboard
Copied
You have to first remove all the calculation scripts you already added. The only script you should be using is under the text field's Validation event.
To apply the same values to multiple fields you can use something like this:
for (var i=0; i<=19; i++) {
if (event.value) {
this.getField("Monday_Dropdown1."+i).setItems(event.value.split(", "));
this.getField("Tuesday_Dropdown1."+i).setItems(event.value.split(", "));
// etc.
} else {
this.getField("Monday_Dropdown1."+i).clearItems();
this.getField("Tuesday_Dropdown1."+i).clearItems();
// etc.
}
}
Copy link to clipboard
Copied
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more