Jump to content



  • Please log in to reply
2 replies to this topic

#1 shan_cool

  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts
  • LocationChennai,India

Posted 10 February 2006 - 04:22 AM

Hi all,

The defect id which i store in the MYSQL is 1,2,3 and so on....In my front end(PHP) it shld be displayed as 00001,00002,and so on,I made it displayed using Lpad in my select queries.
In one of my screen,when i enter the defect id,certain set of records shld be displayed and it wrks fine.
Now the pblm is when i enter the defect id as 1,the query is excuted which is obvious....
Now i need a validation to be carried out which checks for first 4 zeros of the number and then allows the user to get the query excuted.

Can anybody help me,
Thanks in advance,

#2 ccl

  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 09 March 2006 - 12:27 AM

function checkForm(myForm)
if (myForm.myNumberField.length != 5)
alert ("Please enter 4 zeros before number");
return false;
return true;

<form on submit = "return checkForm(this)>

#3 fooDigi

  • Members
  • PipPipPip
  • Advanced Member
  • 250 posts
  • LocationDuluth, Mn

Posted 10 March 2006 - 09:28 AM

regular expressions should be your best friend..

var emailRegex = new RegExp("^0{4}.{1}$");
var emailText = '00003';
document.write("number has 4 zeroes and a positive integer.");
document.write("not today, better make this function return true.");

this should match 4 zeroes than a non-zero integer, i'm sure this must have to be altered.
All your base are belong to us.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users