Results 1 to 3 of 3

Thread: Javascript problem?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517

    Javascript problem?

    This script is suppose to check to see if a date is correctly entered. It doesnt work.

    Anyone see how to fix it?

    PHP Code:
    if (tempobj.name.substring(0,7)=="reqdate") {
                if (
    tempobj.type=='text') {
                    var 
    splitted tempobj.value.match("/\[\d{1,4}\.\d{1,4}\.\d{1,4}\]$/");
                    if(
    splitted == null) {
                        
    pass=false;
                    }
                break;
                }
            } 

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Code:
    /^\d{1,4}\.\d{1,4}\.\d{1,4}$/.test(tempobj.value);
    Ensures three groups of digits 1-4 digits each, separated by dots.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width