Copy link to clipboard
Copied
So I have a combo box that has five items listed (text a, text b,.....) and all the values happen to be 50.
I then have a hidden text field become visible and required when text a is selected. Problem is the script I am using is calculating based off the value (30), and sense all are (30), is there a way to use the item list (name) instead? Or a way to make this work?
Custom calculation script for text field
var d=this.getField("combo1").value;
if (d=="30")
{
event.target.display=display.visible;
event.target.required=true;
}
else
{
event.target.display=display.hidden;
event.target.required=false;
}
Copy link to clipboard
Copied
Do understand what the value of the combo box will be when an item is selected and you have the "Optional Value" filled in?
Do you think you the value of the field will ever be 30 with your approach?
Have you considered adding some debugging statements your code to see what is happening?
Why are you using quotation marks around a number constant?
You only need quotation marks around character strings.
var d=this.getField("combo1").value;(;
console.show();
console.clear();
console.println("combo1 value: " + d)
console.println("d == 30: " + (d == 30);
if (d=="30")
{
event.target.display=display.visible;
event.target.required=true;
}
else
{
event.target.display=display.hidden;
event.target.required=false;
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now