Issue with Client Script

GMoon
Tera Guru

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!

1 ACCEPTED SOLUTION

if (reg == 'service') {

...

if (reg == 'security') {

View solution in original post

19 REPLIES 19

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.

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.

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.

Ok thanks. What should the correct script be, in that case? 

if (reg == 'service') {

...

if (reg == 'security') {