Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Only 1 checkbox can be checked

John Vo1
Tera Guru

I have this client script that should only allow 1 checkbox to be selected, but when I test it still lets me select I agree or I disagree.  Can someone help me out?

find_real_file.png

1 ACCEPTED SOLUTION

Another thought is to possibly just ask if they Agree and then have a Yes/No drop down or if it is important that they choose agree or disagree use a multi-Choice box.  Both these options could be made mandatory unlike check boxes and they can only chose one.  Example of a multi-choice field.

find_real_file.png

You could also use a select box with options I Agree or I Disagree.

View solution in original post

17 REPLIES 17

Brad Bowman
Mega Patron

That seems a bit much.  A simpler script like this will work

if(g_form.getValue('v_prod') == 'true' && g_form.getValue('v_stage') == 'true'){
 alert('Only 1 environment can be selected.');
 return false;
}

find_real_file.png

Seems you missing function.

Try below.

function onSubmit() {
   //Type appropriate comment here, and begin script below
   
if(g_form.getValue('v_prod') == 'true' && g_form.getValue('v_stage') == 'true'){
 alert('Only 1 environment can be selected.');
 return false;
}
}

This script allows me to have nothing check and I can still submit