- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2017 05:29 AM
I need a Mandatory Checkbox as Acknowledgement on a form. The checkbox appears in certain conditions and has to be mandatory if it appears.
Currently I have the checkbox appearing correctly and when i have g_form.setDisplay('MyCheckbox',true), I also set:
g_form.setMandatory'MyCheckbox',true).
The asterisk appears next to the checkbox, but it is always grey. I can obtain the functionality I need with a Business Rule (before update), but my requirement is to actually make the asterisk red so that it is obvious.
Does anyone know a simple solution for this?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2019 08:24 AM
I know this is an old post, so things have changed. In London, at least, there is a "Selection required" checkbox on the variable form. If you check that off, the user MUST check the checkbox. No scripting required.
Rick Seiden
Linium
A Ness Digital Engineering Company
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2017 05:35 AM
You cannot make a true/false required. It defeats the purpose. If its required then its always gona be true , you need to check it to get rid of required stamp.
i suggest, having a yes/no choice field maybe?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2017 05:36 AM
Hi Nicolae,
If you make any field mandatory, it simply says "Make sure someone puts a value here". Since a checkbox only contains a true or false value, it always contains SOME value, which makes mandatory kind of useless.
What you really want to validate is that someone checked the box, right?
You can do an onSubmit client script that does something like this:
var checked = g_form.getValue('MyCheckbox');
if (!checked) {
g_form.addErrorMessage('You didn't check the checkbox!');
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-11-2017 05:18 PM
How would you add a condition for additional checkboxes, and at the same time modify the error message to dynamically display to the user which checkboxes on the form they missed?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-12-2017 05:44 AM
Same way, an onSubmit client script.
var list = [];
var checked1 = g_form.getValue('myCheckbox1');
if (!checked1) {
list.push('My Checkbox 1');
}
// Repeat above bold lines for each checkbox...
if (list.length > 0) {
g_form.addErrorMessage('You need to check the following checkboxes: ' + list.join(','));
return false;
}