Copy link to clipboard
Copied
Hello.
I have a Dropdown1 menu with values: 1, 2, 3, 4. And Textbox1.
I need that when user select 1 in the dropdown menu, the text field is 10,
when user select 2 in the dropdown menu, the text field is 15,
when user select 3 in the dropdown menu, the text field is 20,
when user select 4 in the dropdown menu, the text box was 25.
I am using Java code in Textbox1:
var e = this.getField("Dropdown1").valueAsString;
if (e=="1"){
event.value = "10";
if (e=="2"){
event.value = "15";
if (e=="3"){
event.value = "20";
if (e=="4"){
event.value = "25";
} else event.value = "N/A";
But when using this code an error occurs. How to fix the code?
Thank you.
Copy link to clipboard
Copied
What error? Please show exactly. Also please don’t call it Java, that’s very confusing! Thanks.
Copy link to clipboard
Copied
Hello.
SyntaxError: missing } in compound statement 19: in line 20
Copy link to clipboard
Copied
You can also do it less complicated and assign those values directly in the dropdown field "Properties"--->"Options"
In that tab, there is an export value field underneath the blank "Item" field where you enter the name for a listed item. Here is where you assign the export value for each listed item.
Then on the text field insert this line in custom calculation script:
event.value = this.getField("Dropdown1"). value;
Don't forget to check the option that says commit selected value immediately in Dropdown1 field.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You have only one } for four {
Copy link to clipboard
Copied
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more