Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking for errors 1

Status
Not open for further replies.
May 29, 2001
10
GB
Hi All,

I would like a bit of JS that informs the user of them not inputting all the data that my form requires.

e.g

mail address - david.roberts

And the JS returns informing the form user that they haven't input all of the data, and it should have @hotmail.com inserted at the end.

I have tried to use a piece of script that a colleague wrote a few months ago and it doesn't work, and the colleague has since left.

Regards

Dave
 
u might use smth like this:
function checkErrors(){
var obj=document.forms.myform
if (obj.email.value.indexOf('@')==-1){
alert('wrong email adress')
return false}
return true
}
& ur form contains:

<form id='myform' name='myform' method=&quot;post&quot; action=&quot;&quot; onsubmit=&quot;return checkErrors()&quot;>
<center>
email adress: <input type=text name=email>
</center>
<input type=submit value=submit>
</form>
regards, vic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top