- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2024 04:21 AM - edited ‎09-27-2024 04:24 AM
Hi all,
We have a basic client script which we want to use to show/hide values on our Service and Security Risk Register forms, this is not working. We have tried both 'g_form.removeOption' and 'g_form.addOption' within the script itself but encounter the same issue.
We have even split the scripts out to manage each register individually, but this also did not work.
The Field Type in question is a an Integer.
Can anyone see an issue here or something we have overlooked?
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2024 06:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2024 09:35 AM
The alert confirms the field name and value are correct so that the if statement will be satisfied. So on the security form, when the alert shows 'security' are the 7 choices from the script being removed, or different ones, or more or fewer...? On the service form, does the alert show 'service'? Are the 2 choices from the script removed, or different one, or more, or fewer? With this script inactivated, do you see all of the choices on both forms? It might help to post the current version of the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2024 01:06 AM - edited ‎09-30-2024 01:11 AM
Hi Brad,
With the script inactive, we see all choices across both forms.
On both forms, with the script enabled, the choices are exactly the same. The alert shows the correct 'service' and 'security' pop up's on the respective forms.
I've attached further screenshots to illustrate the behaviour, plus the current version of the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2024 04:41 AM
If statements use == to test the condition. When you use one = you are setting the value of 'reg' in this case, so it will always be true.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2024 06:22 AM
Ok thanks. What should the correct script be, in that case?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2024 06:26 AM
if (reg == 'service') {
...
if (reg == 'security') {