kamal213 Posted August 11, 2011 Share Posted August 11, 2011 Hi guys, I am planing to use a 3 checkboxes e.g. (Yes, No, Maybe). Is it possible to make to if a user checks on one box e.g 'Yes' they cannot then check 'No and Maybe' i.e. disable two other boxes if one is selected for example. If its possible I would appreciate your help. Thanks alot Quote Link to comment https://forums.phpfreaks.com/topic/244490-php-check-box-validation/ Share on other sites More sharing options...
TeNDoLLA Posted August 11, 2011 Share Posted August 11, 2011 I would suggest using radio button for this. Quote Link to comment https://forums.phpfreaks.com/topic/244490-php-check-box-validation/#findComment-1255799 Share on other sites More sharing options...
AyKay47 Posted August 11, 2011 Share Posted August 11, 2011 yes, using javascript and the "disabled" checkbox input type attribute.. Quote Link to comment https://forums.phpfreaks.com/topic/244490-php-check-box-validation/#findComment-1255801 Share on other sites More sharing options...
cyberRobot Posted August 11, 2011 Share Posted August 11, 2011 I would suggest using radio button for this. I concur with TeNDoLLA. Radio buttons already do what you want without having to depend on JavaScript. Quote Link to comment https://forums.phpfreaks.com/topic/244490-php-check-box-validation/#findComment-1255809 Share on other sites More sharing options...
AyKay47 Posted August 11, 2011 Share Posted August 11, 2011 i tend to agree as well, however if you insist on using checkboxes.. you will need javascript Quote Link to comment https://forums.phpfreaks.com/topic/244490-php-check-box-validation/#findComment-1255815 Share on other sites More sharing options...
Pikachu2000 Posted August 11, 2011 Share Posted August 11, 2011 You wouldn't necessarily need javascript. You could validate server-side that only one checkbox is checked from each group and return an error otherwise. But at any rate, radio button arrays would probably be a better option for that application. Quote Link to comment https://forums.phpfreaks.com/topic/244490-php-check-box-validation/#findComment-1255840 Share on other sites More sharing options...
kamal213 Posted August 11, 2011 Author Share Posted August 11, 2011 Sold!!!! I would rather prefer radio button. I suppose my next question would be how do you do this - since am an empty barrel lol Thanks Quote Link to comment https://forums.phpfreaks.com/topic/244490-php-check-box-validation/#findComment-1255847 Share on other sites More sharing options...
kamal213 Posted August 11, 2011 Author Share Posted August 11, 2011 Oh go it working..the input name has to be the same for all three!! Thanks guys you are all masters!!! I salute sensei's!! Takecare!!!! Quote Link to comment https://forums.phpfreaks.com/topic/244490-php-check-box-validation/#findComment-1255851 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.