hi everyone,
Here's part of the codes I got from our website. Right now, when someone wants to register on our website, they have to put into the Captcha after they finish all the other information.
If the captcha is empty, there would be an alert; if it's wrong, the page would be refreshed, and there would be another alert, and at the same time, all the information would be lost and they have to fill them again.
Now the question is, how can I stop the page refreshing itself? All I need is an alert and then you could retype the captcha without losing the other information.
Thank you in advance for your advice!


<script type="text/javascript">
function ltrim(stringToTrim) {
return stringToTrim.replace(/^\s+/,"");
}
function validateForm()
{
var okSoFar=true
with (document.practitioner_profile)
{
if (firstname.value=="" && okSoFar)
{
okSoFar=false
alert("Please enter your first name.")
firstname.focus()
}
if (lastname.value=="" && okSoFar)
{
okSoFar=false
alert("Please enter your last name.")
lastname.focus()
}

//some other things here...

if (verify_code.value=="" && okSoFar)
{
okSoFar=false
alert("Please enter your security code.")
verify_code.focus()
}
if (okSoFar==true) submit();
}
}


//here's the submit button in the html code,

<div class="practsubmit">
<div class="signupform"><h4>* Security Code:</h4> <p>Please type in what you see in the box below and press submit. Characters are case-sensitive.</p></div>
<div class="signupform"><img id="captcha" src="index.php?option=com_egbcaptcha&amp;width=150&amp;height=50&amp;characters=5" /><br /><input id="verify_code" name="verify_code" type="text" /></div>
<input type="button" class="button" value="Send" name="B1" ONCLICK="javascript:validateForm()">&nbsp;<input type="reset" class="button" value="Clear" name="clear">
</div>