- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2020 03:56 AM
HI All,
If a User doesn't check the checkbox then on Submit of catalog request I need to display an alert.
if the user click on OK then request has to be submitted, if the clicks on Cancel then he has to stay back on the form.
With the below script, in both the case form is not getting submitted.
Script:
function onSubmit() {
var checkboxResponse= g_form.getValue('chkbox_verify');
if(checkboxResponse=='false'){
if(confirm('You Have not checked the verification..\n\nPlease press [OK] to continue.')=='true'){
//request has to be submitted.
return true;
}
else{
//Stay back on the form.
g_form.setValue('chkbox_verify', false);
return false;
}
}
}
Can someone help me on this.
Thanks
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2020 04:14 AM
Try this.
function onSubmit() {
var checkboxResponse= g_form.getValue('chkbox_verify');
if(checkboxResponse=='false' || checkboxResponse== false ){
var val=confirm("You Have not checked the verification..\n\nPlease press [OK] to continue.");
if(val){
//request has to be submitted.
return true;
}
else{
g_form.setValue('chkbox_verify', false);
return false;
}
}
}
Please mark this correct & helpful if it answered your question.
Thanks & Regards,
Sharjeel
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2020 05:01 AM
Hi,
can we hide the alert if the particular check is not displayed on the form?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2020 05:06 AM
Hi Sonu,
When you say Particular check, do you mean any other checkbox field is not checked or the field is not available on the form?
Thanks & Regards,
Sharjeel
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2020 04:28 AM
Use can use the same code with few changes just remove =='true' part from confirm box and it will work.
Just one line change on confirm box
function onSubmit() {
var checkboxResponse= g_form.getValue('chkbox_verify');
if(checkboxResponse=='false'){
if(confirm('You Have not checked the verification..\n\nPlease press [OK] to continue.')){
return true;
}
else{
g_form.setValue('chkbox_verify', false);
return false;
}
}
}
Mark helpful and correct.
Thanks,
CB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2020 04:29 AM
Hi Sonu,
Please find the updated script :
function onSubmit() {
var checkboxResponse = g_form.getValue('chkbox_verify');
if(checkboxResponse == 'false' || checkboxResponse == false){
var res = confirm('You Have not checked the verification..\n\nPlease press [OK] to continue.');
if(res){
return true;
}
else{
return false;
}
}
}
As you already checked that "chkbox_verify" is false, no need to set it again as false.
Please consider marking appropriate reply as ✅Correct & 👍Helpful .
Kind Regards,
Mohammad Danish