- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2024 02:26 PM
Please I have a requirement to display an error message "Must provide a reason(s) for your selection".
We have a variable of type "SELECT BOX" with options: True, False, Unknown. So, when a user select "False" from these options, the above error message (in red color) must automatically display to users. Please how do I do this?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 09:08 PM
You can make use of an On-Submit Catalog Client Script. Please refer below screenshots :
function onSubmit() {
var userChoice = g_form.getValue('user_choice'); // Please replace with your catalog variable
if (userChoice == 'false') {
g_form.addErrorMessage('Please provide a reason for your selection before submitting');
return false;
}
}
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 08:55 AM
have you written any object so far, either catalog client scrip or catalog UI policy/action as example given by @Amit Verma , If yes, please share the screen shot of those pages.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 10:38 AM
I used the method suggested by @Amit Verma and it actually displayed the error message. However, I was still able to submit the form even with the displayed error message which we don't want
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 10:57 AM
Its allowing to submit because there is no restriction applied to stop form submission.
You can try with onChange script with return false statement and mark the field mandatory.
Or write onSubmit and check the field value and return false to stop form submission.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 11:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2024 09:02 AM
@ID NOBLE , i see your issue resolved by @Amit Verma example code.
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution