Regular Expression Validator question

Discussion in 'ASP .Net Web Controls' started by curious, Dec 24, 2006.

  1. curious

    curious Guest

    I am using a RegularExpressionValidator to validate a TextBox. I use
    "^[\+|-]?[0-9]+(\.[0-9]*)?$" to check for a real number. The control works
    fine as long as the user enters something in the TextBox; it does not work if
    the user leaves the TextBox blank. Is there a bug in the implementation of
    the RegularExpressionValidator? My regluar expression should also catch no
    entry by the user.

    Thanks.
    --
    ASP.NET fan.
     
    curious, Dec 24, 2006
    #1
    1. Advertising

  2. curious

    marss Guest

    curious wrote:
    > I am using a RegularExpressionValidator to validate a TextBox. I use
    > "^[\+|-]?[0-9]+(\.[0-9]*)?$" to check for a real number. The control works
    > fine as long as the user enters something in the TextBox; it does not work if
    > the user leaves the TextBox blank. Is there a bug in the implementation of
    > the RegularExpressionValidator? My regluar expression should also catch no
    > entry by the user.
    >
    > Thanks.
    > --
    > ASP.NET fan.


    MSDN: "Validation succeeds if the input control is empty. If a value is
    required for the associated input control, use a RequiredFieldValidator
    control in addition to the RegularExpressionValidator control."
     
    marss, Dec 25, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Vallelunga
    Replies:
    2
    Views:
    8,342
    Brian Vallelunga
    Jul 31, 2003
  2. VSK
    Replies:
    2
    Views:
    2,353
  3. Bryce Budd

    Regular Expression Validator

    Bryce Budd, Sep 18, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    587
    Brian Davis
    Sep 18, 2003
  4. Simple Simon
    Replies:
    2
    Views:
    4,379
    Simple Simon
    Nov 4, 2003
  5. Edward
    Replies:
    0
    Views:
    843
    Edward
    Dec 4, 2003
Loading...

Share This Page