- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
Hello, I have a catalog client script that should display a message when a check box is unchecked after being checked.
When the box is unchecked, the error message should show
This is the script I have so far:
Any help is greatly appreciated
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
Hi @DreDay3000 ,
There are no quotes for variable/field you used in the script. Please use below updated script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
}
if (newValue === 'false') {
g_form.showFieldMsg(
'has_call_activation_number_for_this_tree_been_added',
'CANNOT CONTINUE! All items in required information section MUST be met before continuing. Refer to Instructions for more information.',
'error'
);
}
}
If your goal is to block submission until the checkbox is true, you might also want to use an onSubmit client script instead of just onChange. That way, you can prevent the form from being submitted until the condition is met.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
Hi @DreDay3000 ,
Looks like the issue is with the field name in showFieldMsg. You missed quotes around it, so it won’t work.
It should be like this:
g_form.showFieldMsg('has_call_activation_number_for_this_tree_been_added', 'CANNOT CONTINUE! All items in required information section MUST be met before continuing. Refer to Instructions for more information.', 'info');Field name should always be in quotes.
Regards,
Dimple Shaik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
Try with this
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue === '') {
return;
} if (newValue == false && oldValue == true) {
g_form.showFieldMsg('has_call_activation_number_for_this_tree_been_added', 'CANNOT CONTINUE! All items in required information section MUST be met before continuing. Refer to Instructions for more information.'', 'info');
} }
