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

Brad, thank you very much! That has worked. 
Appreciate your time in working through this with me.

Good to hear.  You are welcome - happy to help!

Rajesh Chopade1
Mega Sage

hi @GMoon 

use following updated script and try once again

function onLoad() {
    var reg = g_form.getValue('u_register');

if (reg == 'service') {
g_form.removeOption('state',20);
g_form.removeOption('state',19);
    }

    if (reg == 'security') {
g_form.removeOption('state',12);
g_form.removeOption('state',04);
g_form.removeOption('state',14);
g_form.removeOption('state',13);
g_form.removeOption('state',10);
g_form.removeOption('state',15);
g_form.removeOption('state',08);

    }
    
}

 

Thanks for your reply, this unfortunately did not work.

Sandeep Rajput
Tera Patron
Tera Patron

@GMoon Please try the following script and see if it works for you

 

function onLoad() {

    var reg = g_form.getValue('u_register');
    if (reg == 'service') {
        g_form.removeOption('state', 19); // Extension Requested
        g_form.removeOption('state', 20); // Treatment In Progress
    } else if (reg == 'security') {
        g_form.removeOption('state', 12); // Investigation
        g_form.removeOption('state', 4); // Transferred
        g_form.removeOption('state', 14); // Mitigation Work
        g_form.removeOption('state', 13); // Limited
        g_form.removeOption('state', 10); // Awaiting Closure
        g_form.removeOption('state', 15); // Awaiting Approval
        g_form.removeOption('state', 8); // Approved
    }
}