Copy link to clipboard
Copied
I am attempting to make a few options in a dropdown list UNSELECTABLE by the end-user in a PDF. The unselectable options are actually the Cause of Death categories - we only want the users to select the actual conidtion and not select the category accidently.
Example below:
Hemorrahge (display in dropdown, but make it unselectable)
10.1 Hemorrhage - Uterine Rupture
10.2 Placental Abruption
10.3 Placenta Previa
... etc
Infection (display in dropdown, but make it unselectable)
20.1 Chorioamnionitis
20.2 Sepsis
... etc
Any help would be greatly appreciated. Thank you,
GC
Try this version of the code:
if (event.value) event.rc = /^\d/.test(event.value) || event.value==event.target.defaultValue;
Copy link to clipboard
Copied
Add this code as the field's custom validation script:
if (event.value) event.rc = /^\d/.test(event.value);
This will only allow the user to select items that begin with a number. If you have a default option that you want them to be able to select (something like "Select") then we'll need to adjust the script to allow for that, too (assuming it doesn't start with a number, either).
Copy link to clipboard
Copied
Thank you so much for your suggestion. That is turly amazing - it works, but I am UNABLE to select the " " option that I have as the very option inthe dropdown list. The first option signifies no user seleciton.
The consequence of this is that if I select a value with a number and then change my mind and want to go back to the very first option (" "), I am unable to select that. The selection reverts back to the selection with the number.
Could you please suggest a tweek to the code that will allow me to either select " " or a number and nothing else.
I really appreciate your quick help - it is amazing to see it work. Almost there. Thanks again.
GC
Copy link to clipboard
Copied
Try this version of the code:
if (event.value) event.rc = /^\d/.test(event.value) || event.value==event.target.defaultValue;
Copy link to clipboard
Copied
That worked perfectly. Thanks so much for your assistance. That was most kind.