- 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 04:09 AM
Hello,
Checkbox always return true value,
var checkMod = g_form.getValue('u_modify_text')); //checkMod is true if u_modify_text is checked, false if unchecked
if (checkMod){
}
OR
function onSubmit() {
var checkboxes = ['checkbox1', 'checkbox2', 'checkbox3', 'checkbox4'];
var isSelected = false;
for (var i = 0; i < checkboxes.length; i++) {
if (g_form.getValue(checkboxes[i]) == 'true') {
isSelected = true;
break;
}
}
if (isSelected == false) {
g_form.addErrorMessage('At least one checkbox is required');
return false;
}
}
If answer is helpful mark correct!
Thanks,
Pratiksha

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2020 04:11 AM
Hi,
try this script.
function onSubmit() {
var checkboxResponse= g_form.getValue('chkbox_verify');
if(checkboxResponse=='false'){
var val=confirm("You Have not checked the verification..\n\nPlease press [OK] to continue.");
if(val=='true'){
//request has to be submitted.
return true;
}
else{
//Stay back on the form.
g_form.setValue('chkbox_verify', false);
return false;
}
}
}
Thanks,
Dhananjay.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2020 04:54 AM
Hi Sonu,
Did you find any error in my code?
Thanks,
Dhananjay.

- 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