hey guys, i have come up with this script after researching on the net but i still cannot get the checkbox to enable the submit button only after the checkbox has been checked...any ideas? <script type="text/javascript"> /*<![CDATA[*/ function enable_submit(){ var ck = (document.getElementById("notes").checked)? false:true; document.getElementById("submit_button").disabled=ck; } function valid_email(obj) { var email_ck = obj.visitormail; var str = email_ck.value; var visitor_ck = obj.visitor; var str2 = visitor_ck.value; var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; if (str2 == '') { alert('Please Enter Your Socom Name'); visitor_ck.focus(); return false; } if (!reg1.test(str) && reg2.test(str)) { return true; } else { alert('Please Enter A Valid E-mail Address'); email_ck.focus(); email_ck.select(); return false; } } /*]]>*/ </script> <?php echo ' <form method="post" name="JoinRequest" action="sendit.php" onsubmit="return valid_email(this)">'; $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?> <input type="hidden" name="ip" value="<?php echo $ipi ?>"/> <input type="hidden" name="httpref" value="<?php echo $httprefi ?>"/> <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>"/> <br /> <b><font color="#76A5D5" size="2" face="verdana">Socom Name: </font></b> <input name="visitor" type="text" id="visitor" size="35"/> <br /> <br /> <b><font color="#76A5D5" size="2" face="verdana">Email Address:</font></b> <input type="text" name="visitormail" size="35"/> <br /> <br /> <b><font color="#76A5D5" size="2" face="verdana">Version Trying For:</font></b> <select name="attn" size="1"> <option value=" Socom1 ">Socom </option> <option value=" Socom2 ">Socom 2 </option> <option value=" Socom3 ">Socom 3 </option> <option value=" Socom4 ">Combined Assult </option> </select> <br /><br /> <input type="checkbox" name="notes" value="checkbox" onclick="enable_submit()" /> <font color="#76A5D5" size="1" face="verdana">I Have Read And Agree To Follow The <strong><a href="index.php?view=Rules">Clan Rules</font></a></strong><br /> <br /> <input type="submit" value="Submit" name="submit_button" disabled="disabled"> </form> Code (markup):
You're using getElementId on your enable_submit function but you don't have an ID for the elements you're trying to control. Modify these lines. Take not of the bolded text: <input type="checkbox" [B]id="notes"[/B] name="notes" value="checkbox" onclick="enable_submit()" /> <input type="submit" value="Submit" [B]id="submit_button"[/B] name="submit_button" disabled="disabled"> Code (markup):