- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2020 08:52 PM
hi
i have to write one client script on load of chg req that :
if (logged in user is ammber of group ='abc') {
g_form.setDisplay('cab_required', true); //cab required field is a checkbox field
var field = g_form.getValue('cab_required');
if (field == true) {
g_form.setValue('u_type', 'u_normal', 'Normal');
}
}
how to put this in syntax correctly
thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 02:02 AM
Hi,
Check the output and let me know what is it showing.
function onLoad() {
var display = g_scratchpad.display;
alert(display);
if (display == 1) {
alert("if1");
g_form.setDisplay('cab_required', true);
var field = g_form.getValue('cab_required');
alert(field);
if (field == true) { //is the syntax is proper
g_form.setValue('u_type', 'u_normal', 'Normal');
}
} else {
alert("else");
g_form.setMandatory('cab_required', false);
g_form.setVisible('cab_required', false);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2020 10:26 PM
Hello,
One more thing i want to add. Use g_form.setDisplay() method because setDisplay() will reclaim the space if the field is hidden.
g_form.setDisplay('cab_required', true);
Please mark correct/helpful answer if it help you in any way.
Thanks,
Kunal