None option for a drop down
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2024 07:51 PM
Hi,
How to change the code for the None option to work? The rest of the options are good.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var status = g_form.getValue('u_state');
if(status == 'new'){
g_form.setMandatory('u_in_progress_status', false);
g_form.setMandatory('u_resolved_status', false);
g_form.setMandatory('u_canceled_status', false);
g_form.setVisible('u_new_status', true);
g_form.setMandatory('u_new_status', true);
g_form.setDisplay('u_in_progress_status', false);
g_form.setDisplay('u_resolved_status', false);
g_form.setDisplay('u_canceled_status', false);
}
if(status == 'in_progress'){
g_form.setMandatory('u_new_status', false);
g_form.setMandatory('u_resolved_status', false);
g_form.setMandatory('u_canceled_status', false);
g_form.setVisible('u_in_progress_status', true);
g_form.setMandatory('u_in_progress_status', true);
g_form.setDisplay('u_new_status', false);
g_form.setDisplay('u_resolved_status', false);
g_form.setDisplay('u_canceled_status', false);
}
if(status == 'resolved'){
g_form.setMandatory('u_new_status', false);
g_form.setMandatory('u_in_progress_status', false);
g_form.setMandatory('u_canceled_status', false);
g_form.setVisible('u_resolved_status', true);
g_form.setMandatory('u_resolved_status', true);
g_form.setDisplay('u_new_status', false);
g_form.setDisplay('u_in_progress_status', false);
g_form.setDisplay('u_canceled_status', false);
}
if(status == 'Canceled'){
g_form.setMandatory('u_new_status', false);
g_form.setMandatory('u_in_progress_status', false);
g_form.setMandatory('u_resolved_status', false);
g_form.setVisible('u_canceled_status', true);
g_form.setMandatory('u_canceled_status', true);
g_form.setDisplay('u_new_status', false);
g_form.setDisplay('u_in_progress_status', false);
g_form.setDisplay('u_resolved_status', false);
}
// if((status != 'new') && (status != 'in_progress') && (status != 'resolved') && (status != 'Canceled'){
// g_form.setMandatory('u_new_status', false);
// g_form.setMandatory('u_in_progress_status', false);
// g_form.setMandatory('u_resolved_status', false);
// g_form.setMandatory('u_canceled_status', false);
// g_form.setDisplay('u_in_progress_status', false);
// g_form.setDisplay('u_resolved_status', false);
// g_form.setDisplay('u_canceled_status', false);
// g_form.setDisplay('u_new_status', false);
// }
}
In the picture you can see the New status is not getting removed when I change the status to None.
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2024 08:56 PM
Hi @Community Alums
To do that You can try this:
if (g_form.getValue('your_choice_field') == "") {
//do the following
}
Thanks and Regards
Sai Venkatesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2024 01:51 AM
Hi @SAI VENKATESH,
I used this but it didn't work.
if(g_form.getValue('u_state') == ''){
g_form.setMandatory('u_new_status', false);
g_form.setMandatory('u_in_progress_status', false);
g_form.setMandatory('u_resolved_status', false);
g_form.setMandatory('u_canceled_status', false);
g_form.setDisplay('u_in_progress_status', false);
g_form.setDisplay('u_resolved_status', false);
g_form.setDisplay('u_canceled_status', false);
g_form.setDisplay('u_new_status', false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2024 09:44 PM
Hello @Community Alums
For this type of scenario, a UI Policy is the best solution as it requires no scripting and only configuration setup. Please refer to the screenshots below for the complete solution.
case 1: when state is new
case2: when state is Resolved
case3: State is in progress
case4: state is cancelled
case5: state is None
Preview Result:
and similarly for other status.
"If you found my answer helpful, please give it a like and mark it as the accepted solution. It helps others find the solution more easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2024 01:50 AM
Hi @Juhi Poddar,
Of course I can but I don't want to. I am trying to increase my development skill.
Regards
Suman P.