
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 07:38 AM
Hello everyone!
I need some assistance today. I have a custom application (IBM Resilient Integration) that I built out for my security response team and they would like to have a modification done to the checkboxes. Yes, I have already approached them to use select boxes for the selections since it would be easier but they want the users to have to opportunity to select one or more checkbox while making a selection mandatory with an alert if nothing is selected.
Below are the checkboxes that I'm using:
Any guidance or help is greatly appreciated!
Thanks,
Terry
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 12:45 PM
Yes, understood the problem.
The earlier code returns error when atleast one of them is false.
so instead of || use && and then it will fire only if all of those are unchecked.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 11:59 AM
Also it didn't allow me to submit the form which is a plus.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 12:05 PM
Nevermind I had miss typed false in the code but it still let me Submit the form with no error message showing up.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 12:11 PM
If the form is still submitting after clearing the spelling mistake, then add this line inside the if condition after the display of the error message
return false; //this will prevent the submission of the form

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 12:23 PM
Just made the modifications and it still submitted the incident with no error message.
function onSubmit() {
//Type appropriate comment here, and begin script below
if(g_form.getValue("customer") == false || g_form.getValue("non_customer") == false || g_form.getValue("team_member") == false || g_form.getValue("vendor") == false || g_form.getValue("other") == false || g_form.getValue("unknown") == false) {
g_form.addErrorMessage("Please select atleast 1 checkbox");
return false; //this will prevent the submission of the form
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 12:26 PM
Lets try with 1 thing and check
if(g_form.getValue("customer") == false) {
g_form.addErrorMessage("Please select atleast 1 checkbox");
return false; //this will prevent the submission of the form
}
}
If it did not work, then try this, placing double quotes
if(g_form.getValue("customer") == "false") {
g_form.addErrorMessage("Please select atleast 1 checkbox");
return false; //this will prevent the submission of the form
}
}