Re: Form Validation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



this is a PHP mailing list, may be u ask this on a js mailinglist

ralph_deffke@xxxxxxxx


""Micheleh Davis"" <M@xxxxxxxxxxxx> wrote in message
002901ca1b68$fc6b0020$f5410060$@COM">news:002901ca1b68$fc6b0020$f5410060$@COM...
> Please help.  My form validation worked fine until I added the terms check
> at the bottom.  Any ideas?
>
>
>
> //form validation step one
>
> function validateStep1(myForm){
>
>                 // list of required fields
>
>                 with (myForm) {
>
>                                 var requiredFields = new Array (
>
>                                                 firstName,
>
>                                                 lastName,
>
>                                                 phone,
>
>                                                 email,
>
>                                                 terms)
>
>                                 }
>
>                 // check for missing required fields
>
>                 for (var i = 0; i < requiredFields.length; i++){
>
>                                 if (requiredFields[i].value == ""){
>
>                                                 alert ("You left a
required
> field blank. Please enter the required information.");
>
>                                                 requiredFields[i].focus();
>
>                                                 return false;
>
>                                 }
>
>                 }
>
>                 // check for valid email address format
>
>                 var eaddress= myForm.email.value;
>
>                 var validaddress=
> /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})$/;
>
>                 //var validaddress= /^((\w+).?(\w+))+@\w+/i;
>
>                 var result= eaddress.match(validaddress);
>
>                 if (result == null) {
>
>                                 alert ("Please enter your complete email
> address.");
>
>                                 myForm.email.focus();
>
>                                 return false;
>
>                 }
>
>                 // check for valid phone format
>
>                 var check= myForm.phone.value;
>
>                 check= check.replace(/[^0-9]/g,"");
>
>                 if (check.length < 10) {
>
>                    alert ("please enter your complete phone number.");
>
>                    return false;
>
>                 }//end if
>
>
>
>                 return true;
>
>
>
>                 //begin terms and conditions check
>
>                 var termsCheck= myForm.terms.value;
>
>                 if (bcForm1.checked == false)
>
>                 {
>
>                                 alert ('Please read and select I Agree to
> the Terms and Conditions of Service.');
>
>                                 return false;
>
>                 }
>
>                 else
>
>                 {
>
>                                 return true;
>
>                 }
>
>                //end terms check
>
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux