- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 12:21 PM
I have a true/false field on a form that I want to make mandatory. After reading through some posts, I came across this one, which recommended writing the following onSubmit client script:
function onSubmit() {
var value = g_form.getValue('searched_resources');
if(!value){
alert('Please check the checkbox before submitting a new HR Request');
return false;
}
}
I have UI Type set to All, but I can still submit this form without checking the checkbox. What am i missing? Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 01:02 PM
Can you try something as below and it will work
function onSubmit() {
//Type appropriate comment here, and begin script below SpaceIsThePlace
if (g_form.getValue('searched_resources')=='false') {
alert('Please check the checkbox before submitting a new HR Request');
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 12:25 PM
Hi,
Any reason for not just using a UI Policy?
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 12:34 PM
hey Goran, I tried a UI Policy, but since it's true or false, it appears to always be filled in. I know I could make a choice list field instead, but I like the look of the checkbox and am hoping that I can use an onSubmit client script to alert a user that the checkbox must be checked before submission.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 01:01 PM
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2018 01:02 PM
Can you try something as below and it will work
function onSubmit() {
//Type appropriate comment here, and begin script below SpaceIsThePlace
if (g_form.getValue('searched_resources')=='false') {
alert('Please check the checkbox before submitting a new HR Request');
return false;
}
}