[thelist] Simple Javascript field checking

Chris.Marsh at Callserve.com Chris.Marsh at Callserve.com
Thu Feb 24 10:26:07 CST 2005


[..]

> Quite so, I realised that after I'd written it. I changed it 
> to onBlur:
> <tr>
>   <td>Email: </td>
>   <td><input type="text" name="regEmail"></td>
> </tr>
> <tr>
>   <td>Email (repeat): </td>
>   <td><input type="text" name="regEmail2" onBlur="checkEmail();"></td>
> </tr>
> 
> I still have the same issue.
> 
> I'm going to use the return true/false later when I do a final form
> check. If any check returns false then I won't want to submit the
> form. For now, I do nothing with it.

Not that you asked for it, but what about the following. You could obviously
throw in an actual email validation script as well. It would cut down the
number of fields on your page, and would reduce the number of people
duplicating an invalid email address by copying and pasting.

<html>
	<script>
		function checkVal(o)
		{
			if(prompt('Please re-enter your email address') !=
o.value)
			{
				alert('Your email addresses do not match');
				o.focus();
			}
		}
	</script>
	<form>
		<input type='text' onblur='checkVal(this)' />
	</form>
</html>

Regards

Chris Marsh

_______________________________________________________________________
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender and delete the email immediately. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. 

Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.

Finally, the recipient should check this email and any attachments for the presence of viruses. Callserve Communications accepts no liability for any damage caused by any virus transmitted by this email. _______________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service.


More information about the thelist mailing list