Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

need some help regarding verifyform

Javascript coding ..

Moderators: macek, egami, gesf

need some help regarding verifyform

Postby whitemoss » Wed Aug 24, 2005 8:25 pm

Hi All,

I dunno how to alter the code below:

Code: Select all

<!-- Begin
function verifyForm()
   var themessage = "You are required to complete the following fields: ";
   var valid = "191111111" // numbers only
   var ok = "yes";
   var temp;
   if (document.form1.MobileNumber.value=="")
      themessage = themessage + " - Enter Mobile Number";

      return false;

   for (var i=0; i < document.form1.MobileNumber.value.length; i++)
      temp = "" + document.form1.MobileNumber.value.substring(i, i+1);
      if (valid.indexOf(temp) == "-1") ok = "no";

   if (ok == "no")
      alert("Invalid entry!  Only numbers are accepted!");
      return false;

   return true;
//  End -->


actually that code will reflect if user didnt enter any value for mobile number and also enter non digit of mobile number..but when user enter mobile number which consist of 0, pop up window "Invalid entry! Only numbers are accepted!" appeared. 0 is still a how to alter that code...

thanks in advance
New php-forum User
New php-forum User
Posts: 55
Joined: Thu Apr 14, 2005 1:28 am
Location: Malaysia

Return to JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.