
- 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:22 AM
Okay I tried the code and I got no more errors. Had to add a } as it was missing.
However, I received no alert and I was still able to submit the form with no checkbox selected.
function onSubmit() {
//Type appropriate comment here, and begin script below
if(g_form.getValue("customer") == "" || g_form.getValue("non_customer") == "" || g_form.getValue("team_member") == "" || g_form.getValue("vendor") == "" || g_form.getValue("other") == "" ) {
g_form.addErrorMessage("Please select atleast 1 checkbox");
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 11:27 AM
Okay.
So lets first check the values of this to understand it its empty or false. What it returns when not checked.
try this code and share the output screenshot of these messages.
function onSubmit() {
g_form.addInfoMessage("Customer value is"+g_form.getValue("customer"));
g_form.addInfoMessage("Non Customer value is"+g_form.getValue("non_customer"));
g_form.addInfoMessage("Vendor value is"+g_form.getValue("vendor"));
g_form.addInfoMessage("Team member value is"+g_form.getValue("team_member"));
g_form.addInfoMessage("Other value is"+g_form.getValue("other"));
//Type appropriate comment here, and begin script below
if(g_form.getValue("customer") == "" || g_form.getValue("non_customer") == "" || g_form.getValue("team_member") == "" || g_form.getValue("vendor") == "" || g_form.getValue("other") == "" ) {
g_form.addErrorMessage("Please select atleast 1 checkbox");
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 11:41 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 11:46 AM
okay, great.
So instead of empty, we shall try false
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.addErrorMessage("Please select atleast 1 checkbox");
}
}
Mark the comment as a correct answer and my other comment(s) as helpful once worked.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 11:58 AM