Very Simple email validation onchange?
Posted on 2004-10-14
I need a very simple email validation script (so simple I can't do it :-( ). can u help?
I have this input field:
<input name="register_email" type="text" size="30" maxlength="50" onblur="this.value=this.value.replace(/ /g,'_')" onfocus="change2Msg(2);" value="<cfif isdefined('url.em')><cfoutput>#url.em#</cfoutput></cfif>">
I need to FORCE the user to stay in the input field if no '@' or '.' is part of the entered string. I'm sure this is goofy but it would help me with a very simple task I need.
Does this make sense?
In otherwords ... when I tab (or click) into this text field 'register_email' and I fail to enter a text string that contains an '@' and an '.' (i.e. fred instead of 'firstname.lastname@example.org') then when I leave the field ... force the user BACK into the text input field.
(i need to keep that onfocus="change2Msg(2);" code in my line and the coldfusion output field for value.)
Thanks for any help!