War_Hero Posted January 19, 2010 Share Posted January 19, 2010 Hi all. I'm pretty new to Javascript and have a little problem. On my website, an admin can either select to Accept or Decline a registration from another user, but they cannot do both. Therefore, to prevent the situation of them accidentally selecting both check boxes, I need one of them to be disabled. For example, when the admin ticks the Accept box, the Decline box becomes disabled, and vice versa. I have tried a few things using info I've found on the web, but haven't had any success. So far, this is what I have: <html> <head> <script language = "javascript"> function setAccept() { var flag = document.subchoice.accept; flag2 = document.subchoice.decline; flag.checked = true; if(flag.checked == true) { flag2.disabled = true; } } function setDecline() { var flag = document.subchoice.decline; flag2 = document.subchoice.accept; flag.checked = true; if(flag.checked == true) { flag2.disabled = true; } } </script> </head> </html> And the PHP form: else { while ($sreg = mysql_fetch_assoc($runreg)) { print " {$sreg['forename']} {$sreg['surname']} {$sreg['gender']} {$sreg['form']} {$sreg['dob']} {$sreg['year']} {$sreg['login_name']} "; } I will, in the end, need to store the accepted registrations in my database, but I will focus on that once I have solved this problem. I've probably done the Javascript bit wrong...I'm new to this. So any help will be highly appreciated. Thank you. :) Quote Link to comment Share on other sites More sharing options...
seanybob Posted January 19, 2010 Share Posted January 19, 2010 http://www.echoecho.com/htmlforms10.htm Hopefully that will help Quote Link to comment 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.