Copy link to clipboard
Copied
Hello,
I am currently creating a form where i am using a script that will populate more fields or selection depending on the option. However, i am running into the issue where i make a selection and then the other options stay visible.
Current script i am using "xx" and "xxx" are place holders.
var selectedValue = this.getField("Selection").value;
// Perform actions based on the selected value
if (selectedValue === "01") {
this.getField("02").display = display.visible;
this.getField("03").display = display.visible;
this.getField("04").display = display.visible;
this.getField("05").display = display.visible;
this.getField("002").display = display.hidden;
this.getField("003").display = display.hidden;
this.getField("004").display = display.hidden;
} else if (selectedValue === "001") {
this.getField("01").display = display.hidden;
this.getField("02").display = display.hidden;
this.getField("03").display = display.hidden;
this.getField("04").display = display.hidden;
this.getField("002").display = display.visible;
this.getField("003").display = display.visible;
this.getField("004").display = display.visible;
} else {
So you can see when i make a selection some fields will become visible and other will become hidden. I need to be able to make them hidden or reset again once i change selections. Thank you in advance.
Copy link to clipboard
Copied
in the future, to find the best place to post your message, use the list here, https://community.adobe.com/
p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.
<"moved from using the community">
Copy link to clipboard
Copied
Where did you place the code?
Copy link to clipboard
Copied
PS. This is JavaScript, not Java...
Copy link to clipboard
Copied
Currently, i have that code in my first radio button selection. Once the "001" option is selected i have another option that needs to be chosen and then populate the rest of the fields.
Copy link to clipboard
Copied
Move the code to the calculation event of any text field (it can even be hidden).
Copy link to clipboard
Copied
It looks like the issue is that previous selections are leaving some fields visible when switching. To fix this, you should first hide all fields before making the relevant ones visible based on the new selection. This way, every time you change the selection, only the correct fields will be shown while others remain hidden. Hope this helps!
Copy link to clipboard
Copied
Hello,
I believe i have done this on a "property level" setting all the fields as hidden until the selection is made. The script just shows the events that follows that selection. So far i have added another script the secondary radio options and seems to be working as of now. Thank you for the response.