Check box field mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2024 06:49 AM - edited 06-27-2024 06:53 AM
I need to make check box field mandatory at certain state, I am trying with this script to not allow without checked but doesnt work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2024 06:57 AM - edited 06-27-2024 07:06 AM
Presuming your field u_shipment is a True/False type and it's Default value is set to false change this line:
to:
Regards
Paul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2024 07:03 AM - edited 06-27-2024 07:06 AM
Hi @samadam,
You have a couple of options available for you depending on whether this is a checkbox on a Catalog Item (a variable) or is it's a checkbox field on a task table such as Incident for example.
For a Catalog variable: Leverage the "Selection required" checkbox on the variable form
For a table that extends task: g_form.setMandatory('checkbox_field_name', true);
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
var bd = g_form.getValue('u_shipment');
var rec_state = g_form.getValue('u_state');
if (!g_form.getValue('u_shipment') && rec_state == 'ship') {
g_form.setMandatory('u_shipment', true);
g_form.addErrorMessage('Shipment must be checked to continue');
return false;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-27-2024 07:18 AM
Tried both suggestions and did not work. This is a custom table. It behaves as if it doesnt hit the OnSubmit script