Mandatory CheckBox on Form

odinx16
Kilo Contributor

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?

1 ACCEPTED SOLUTION

Rick Seiden
Mega Sage

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

View solution in original post

10 REPLIES 10

Trying to adapt this into an onBefore Business Rule on my table, and while it works when I manually change the "State" field (the filter condition is "When State changes"), it does not work when a UI Action is used to change the State field:



(function executeRule(current, previous) {



var list = [];


var deptpriorityField = current.u_departmentpriority;



if (!deptpriorityField) {


list.push('Department Priority');


}


// if (!categoryField) {


// list.push('Category');


// }



// Repeat above bold lines for each checkbox...


if (list.length > 0) {


gs.addErrorMessage(gs.getMessage('You need to check the following checkboxes: ' + list.join(', ')));


current.setAbortAction(true);


//gs.setRedirect(current);


}



})(current, previous);


Rick Seiden
Mega Sage

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

Do i need to make it true for all the checkboxes or just for one its enough?

 

I don't believe you can use this feature on a group of checkboxes. As in, you have 5 choices and the user must select one or more of those choices.  I think it only works on single checkboxes, like, "I have read the Terms and Conditions," type checkboxes.

 

Rick Seiden

Now with Cask LLC.

Thankyou...i got it