JS allows blanks as text

Results 1 to 2 of 2

Thread: JS allows blanks as text

  1. #1
    Oden Guest

    Default JS allows blanks as text

    I am using a JS validator script to require that fields be filled in but people can just space in a field, and the validator accepts that as text.<BR><BR>So I put in this JS in each &#060;input&#062; which eats any whitespace at the beginning of a text field. But it only does it on the first submit attempt.<BR><BR>Any suggestions on a better solution?<BR><BR>onChange="javascript:while(&#039; &#039;+this.value.charAt(0)==&#039; &#039;)this.value=this.value.substring(1,this.valu e.length);"

  2. #2
    Join Date
    Dec 1969

    Default RE: JS allows blanks as text

    heard of regular expression? the JScript language reference (to the left of this page) explains it fairly well.<BR><BR>also, how are you calling your validation? you may benefit from an article in the javascript section of http://www.infinitemonkeys.ws/<BR><BR>j

Posting Permissions

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