Force Mandatory Variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 02:37 PM - edited 11-08-2023 08:39 PM
Hi Connections,
I have a variable. Safe Updating with three choices, when safe updating is selected, I want to push user to fill any ONE of the below variables, Standard User Role OR Safe Manager Role. How can I achieve this. any suggestions... to show that two variables i have created UI policy to appear on the form when safe updating is selected....
appreciate any help.
Best Regards,
Rafmine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 09:31 PM
Hi Danish,
Yes on selection of 'Add User to Safe' I'm getting those 2 fields correct...
below is the Screeshot for variable.. data Type is Multiple Choice...
I appreciate your time and efforts...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 09:38 PM - edited 11-08-2023 09:39 PM
@Community Alums ,
All seems to be good. Can u put an alert for all 3 variables safeupdt,stdrole & safemgr role. wht is coming when u submit. Something like this
function onSubmit() {
//Type appropriate comment here, and begin script below
var abc = g_form.getValue('add_user_safe');
var stdRole = g_form.getValue('standard_user_role');
var safeMgrRole = g_form.getValue('safe_manager_role');
alert("Safe Update :- " + safeupdt);
alert('stdRole :- '+stdRole);
alert('safeMgrRole:- '+safeMgrRole);
if(abc == 'Add User to Safe' && (stdRole == '' || safeMgrRole == '')){
alert('Kindly fill the Standard User Role Value & Safe Manager Role Value');
return false;
}else{
return true;
}
}
Also i hope the UI type is set to ALL on the client script, if you are running it on portal.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 10:20 PM
Hi Danish,
Yes, I have selected UI type is set to ALL on the client script, if you are running it on portal.
Below is the screenshot for your reference..
I really appreciate your time and support...
Rafmine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 10:38 PM
Hi Danish,
If I select the values in both the fields then only the form is getting submitted... check my below client script code...
have also tried with below code as well but no luck..
Rafmine.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 10:47 PM
Hi @Community Alums ,
Apologies. Plz try this.
function onSubmit() {
//Type appropriate comment here, and begin script below
var abc = g_form.getValue('add_user_safe');
var stdRole = g_form.getValue('standard_user_role');
var safeMgrRole = g_form.getValue('safe_manager_role');
if(safeupdt == "Add User to Safe"){
if(stdRole == "" && safeMgrRole == "")){
alert('Kindly fill the Standard User Role Value & Safe Manager Role Value');
return false;
}else{
return true;
}
}
}
Thanks,
Danish