Hi Guys,
i have a registration form and i have added a terms and conditions checkbox on it.
If a user trys to register without accepting terms and conditions a pop up should appear letting them know they need to check the box to continue
This works fine in firefox
In IE nothing happens when i click the submit button, i don't get any error, even if the checkbox is ticked still nothing happens when the submit button is pressed
I dont have a direct link to the form but this is the code that is causing the issue
Code:<script type="text/javascript"> window.onload=function(){ document.forms[0].onsubmit=function(){ return checkIt(); } } function checkIt() { if(document.getElementById('tos').checked==false) { alert('you need to check the "I accept terms of service" box'); document.getElementById('tos').className='highlight' return false; } else { document.getElementById('tos').className=''; return true; } } </script>HTML Code:<FORM ACTION="" NAME="CorpForm" METHOD="post"> </TABLE></TD></TR></TABLE><BR><BR> <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="0" WIDTH="100%"><TR><TD CLASS="maindarker" ALIGN="left"> Login Information <TABLE BORDER="0" CELLPADDING="4" CELLSPACING="0" WIDTH="100%"> <TR><TD CLASS="mainlightest" COLSPAN="2"> Please enter below a username and a password of your choice. </TD></TR> <TR> <TD CLASS="mainlightest" >Username *</TD><TD CLASS="mainlightest" ><INPUT TYPE="TEXT" NAME="username" value="USERNAME" /></TD></TR> <TR> <TD CLASS="mainlightest" >Password *</TD><TD CLASS="mainlightest" ><INPUT TYPE="PASSWORD" NAME="password" /></TD></TR> <TR> <TD CLASS="mainlightest" >Confirm Password *</TD><TD CLASS="mainlightest" ><INPUT TYPE="PASSWORD" NAME="password_confirm" /></TD></TR> <TR><TD>##TERMS##</TD></TR> </TABLE></TD></TR></TABLE> <INPUT TYPE="hidden" NAME="submitted" VALUE="true" /> <input type="hidden" name="scheck" value="" /> <P ALIGN="right"><INPUT TYPE="Image" NAME="SUBMIT" VALUE="NEXT" SRC="/images/submit.png" ALT="NEXT" /></P> </FORM>does anyone know what i am doing wrongPHP Code:$terms = '<form method="post" action="checkIt();">
<input id="tos" type="checkbox"><label for="tos"> I accept terms of service</label>
</form><br><a id="displayText" href="javascript:toggle();">click here to view terms and conditions</a>
<div id="toggleText" style="display: none">
<p>here are the terms and conditions</p>
</div>';
$content = preg_replace('/##TERMS##/', $terms, $content);
any help is appreciated
thanks



Reply With Quote




Bookmarks