JScript validation issues

Results 1 to 2 of 2

Thread: JScript validation issues

  1. #1
    Join Date
    Dec 1969

    Default JScript validation issues

    Hi,<BR><BR>I&#039;m having difficulties with validation, I&#039;m trying to ensure that the user inputs only digits in the txt box and that its over a certain length. However the problem arises when I input a tel. no and leave a space between the area code and the number is there anyway I can allow the user to input for example 617 295 1111 as opposed to 617295... which doesn&#039;t throw up an error<BR>The code I currently have is as follows:<BR><BR>else if((window.document.frmUser.TelephoneNo.value == "" )&#124&#124 isNaN(window.document.frmUser.TelephoneNo.value) &#124&#124(window.document.frmUser.TelephoneNo.val ue.Length&#060;6) )<BR><BR> {<BR> alert("Please enter a valid telephone."); <BR> window.document.frmUser.TelephoneNo.focus();<BR><B R>

  2. #2
    Join Date
    Dec 1969

    Default RE: JScript validation issues

    Simply remove all the spaces... you can use string.replace, or if you&#039;re a bit more savvy, use a regular expression. Then your check should go fine. (although you&#039;ll have to watch for (, ), and -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts