Copy link to clipboard
Copied
I am having issues with a calculated dropdown box. The dropdown box (D2) is being calculated based off of the value of another dropdown (D1) on my form. For example, if D1 = "View Only" then the options in D2 should be "Does Not Need View Only" or "Needs View Only". I have been able to accomplish this via a calculated javascript (below for reference).
However; my issue is when I make my selection in D2 and I click away from the dropdown box it automatically defaults to the top of the list (i.e. If I select "Needs View Only" in the drop down and click away it will jump back up to "Does Not Need View Only"). I am pretty sure it is an issue with one of the properties of the dropdown but cannot figure out which one. I have played around with the Sort items and Commit after selected flag on the options tab of the properties with no help. If needed I can send screenshots of my current configuration of the dropdown properties. Any help would be greatly appreciated!!
Javascript :
if (event.value=="View Only") this.getField("D2").setItems(["Does Not Need View Only", "Needs View Only"]);
Move it to the Validation event. That way it will only execute when you make a selection in that field, not in any field.
Copy link to clipboard
Copied
Where does you use the script?
Copy link to clipboard
Copied
The script is located in the Calculate tab of D1 dropdown box. It is in the Custom calculation script box.
Copy link to clipboard
Copied
Move it to the Validation event. That way it will only execute when you make a selection in that field, not in any field.
Copy link to clipboard
Copied
That did it!! Thank you so much for your help try67, I actually stole my javascript code from an earlier post of yours so you have helped me twice on this issue!! 🙂
Copy link to clipboard
Copied
The calculation scripts overrides your selection. You can't have it both ways.
Copy link to clipboard
Copied
Are there any other ideas for how I could perform what I am trying to get done. Essentially what I am doing is trying to implement some sort of dynamic filtering. In reality D1 has several options to choose from in addition to View Only and I want D2 to be filtered based on D1's selection so I am not delivering a huge list of options to the users.
Copy link to clipboard
Copied
It is posssible, if set up correctly. See my reply above about where to place the code.