Copy link to clipboard
Copied
I am stuck at about 90% progress towards my goal. The goal is to have various text elements on a form automatically be updated based on the value selected in a dropdown field on the form. For example, I have a dropdown box with the name "Role". It currently has 2 possible values, "Default" (which is the default value), and "Tester". I also have a text box with the name "Description", which is the object I want to conditionally format based on the value selected in the "Role" dropdown box. I have this working currently, except for one issue: in order to get the formatting on the "Description" text to change, I have to click into that field of the form (only commits when focus shifts to that field). What id like is for the text change to be applied immediately. The text in the Description box is actually going to be static (other than color change), so id rather it just be text rather than a text entry box, however I couldnt get that to work at all which is why its a text field. Currently on my "Description" text field I have a custom calculate script as follows:
var role = (this.getField("Role").value);
if (role=="Tester")
{
event.target.textColor=color.blue;
}
else
{
event.target.textColor=color.black;
}
And again, the above works, except that it only does so after focus changes to the "Description" field whereas id like it to commit as soon as the option is selected on the "Role" dropdown. I attempted moving the script to be bound to mouse events (mouse enter, mouse exit, etc) on the dropdown instead, but didnt get any better results.
Make sure to set the option to commit the selected value of the drop-down field immediately.
You'll find it under Properties, Options tab.
Copy link to clipboard
Copied
Make sure to set the option to commit the selected value of the drop-down field immediately.
You'll find it under Properties, Options tab.
Copy link to clipboard
Copied
I did find that a while after posting this. I later ran into a different problem (an apparent cap on the number of Cases in a switch), but I think ive worked around that at this point as well. Thanks for replying thuogh!
Copy link to clipboard
Copied
There's no limit to the amount of cases you can add to a switch command. There is one to the length of the script you can input into the internal JS editor of Acrobat, though.