Current location: Hot Scripts Forums » General Web Coding » JavaScript » Error trapping x@x.xxx in form


Error trapping x@x.xxx in form

Reply
  #1 (permalink)  
Old 07-09-03, 05:04 AM
jonathen's Avatar
jonathen jonathen is offline
Newbie Coder
 
Join Date: Jun 2003
Location: Essex, UK
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Question Error trapping x@x.xxx in form

Hi all,

I have a javascript function I use for ensuring that the person filling in my form fills out each of the fields. This works well, but there is another feature I would like to add to it, but do not know what the syntax is, nor how I would be able to incorporate it into my current script without breaking it. I would like to ensure that not only does the person fill out all fields, including the email address field, but that if he/she was to fill out the email field with n/a or something that is not x@x.xxx (in other words a valid email string), it returns an alert alike to the ones I already use (in this case, telling the user to enter a real email address)

Any help is appreciated

This is my current script:

<!--
function checkform ( form )
{

// ** START **
if (form.name.value == "") {
alert( "Please enter your full name." );
form.name.focus();
return false ;
}
// ** END **
// ** START **
if (form.address.value == "") {
alert( "Please enter your full address." );
form.address.focus();
return false ;
}
// ** END **
// ** START **
if (form.postcode.value == "") {
alert( "Please enter your postcode." );
form.postcode.focus();
return false ;
}
// ** END **
// ** START **
if (form.phone.value == "") {
alert( "Please enter your phone number, including area code." );
form.phone.focus();
return false ;
}
// ** END **
// ** START **
if (form.emailaddr.value == "") {
alert( "Please enter your correct email address." );
form.emailaddr.focus();
return false ;
}
// ** END **
return true ;
}
//-->
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 07-11-03, 04:02 AM
jonathen's Avatar
jonathen jonathen is offline
Newbie Coder
 
Join Date: Jun 2003
Location: Essex, UK
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Don't worry about it - I found the answer and got it working.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkboxes on form = mailto recipient. Bojon PHP 4 12-21-04 07:07 PM
SQL database registration form help vinhkhuong PHP 3 10-10-03 04:49 AM
asp: URGENT! need to change code to create new form per id seala ASP 2 09-09-03 10:54 PM
close form sasi ASP 4 08-26-03 04:51 AM
Need Bravenet Alternative... bobby444 General HotScripts Site Discussion 10 07-17-03 10:36 PM


All times are GMT -5. The time now is 07:22 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.