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

amaradiswamy
Kilo Sage

Hi @GMoon 

 

I checked your screenshot "Client script 2", it looks like the logic was written outside the onLoad function.

remove the curly bracket in line number 4 and add curly brace after 20

AnushaB
Tera Expert

Hi @GMoon,
You have written the logic outside the onLoad() method. Please do check the reference image

AnushaB_0-1727438141071.png

 

AnushaB
Tera Expert

Hi @GMoon,
The code you have written outside of the onLoad() method. Please do check the reference image attached below.

AnushaB_0-1727438493485.png

Thanks,
Anusha Bonthu

Brad Bowman
Kilo Patron
Kilo Patron

Your second if statement is nested inside the first, which logically doesn't make sense as the second will never run, and since both are outside of the onLoad function, the first will also never run.  Move the } from line 4 to line 8.  If it's still not working as expected, add an alert to line 4 to confirm the value used in the if statements:

alert('reg value = ' + reg);