Combine regular expression validator with javascript function?

Discussion in 'ASP .Net' started by Dot net work, May 7, 2004.

  1. Dot net work

    Dot net work Guest

    Hello.

    Say I have a .net textbox that uses a .net regularexpressionvalidator.
    If the regular expression fails, is it possible to launch a small
    client side javascript function to do something, such as change the
    border color of the textbox to red? That would look quite nice: if
    the expression fails, the red validator text is shown, plus the
    textbox's border goes red.

    TIA,
    -dnw.
     
    Dot net work, May 7, 2004
    #1
    1. Advertising

  2. Dot net work

    Dot net work Guest

    I was not able to somehow combine the regular expression validator
    control with a client side javascript function, so instead I took the
    regular expression that I needed and put it inside a custom validator
    client side function, then added on some extra javascript that changed
    the textbox border to red.

    -dnw.

    (Dot net work) wrote in message news:<>...
    > Hello.
    >
    > Say I have a .net textbox that uses a .net regularexpressionvalidator.
    > If the regular expression fails, is it possible to launch a small
    > client side javascript function to do something, such as change the
    > border color of the textbox to red? That would look quite nice: if
    > the expression fails, the red validator text is shown, plus the
    > textbox's border goes red.
    >
    > TIA,
    > -dnw.
     
    Dot net work, May 8, 2004
    #2
    1. Advertising

  3. Dot net work

    Peter Blum Guest

    There is a solution that avoids rewriting every validator. It requires using
    a replacement to Microsoft's validators that is designed to handle this kind
    of communication. Microsoft's validators are limited to showing an error
    message in the location of the validator. There are other ways to
    communicate to the user: setting focus to the field, changing the field,
    label or background color, blinking the error message and putting up an
    alert. "Professional Validation And More"
    (http://www.peterblum.com/vam/home.aspx) has all of these capabilities
    supporting its 22 validators. Its designed to avoid writing custom code and
    hacks due to the many limitations of Microsoft's validators.

    --- Peter Blum
    www.PeterBlum.com
    Email:
    Creator of "Professional Validation And More" at
    http://www.peterblum.com/vam/home.aspx


    "Dot net work" <> wrote in message
    news:...
    > I was not able to somehow combine the regular expression validator
    > control with a client side javascript function, so instead I took the
    > regular expression that I needed and put it inside a custom validator
    > client side function, then added on some extra javascript that changed
    > the textbox border to red.
    >
    > -dnw.
    >
    > (Dot net work) wrote in message

    news:<>...
    > > Hello.
    > >
    > > Say I have a .net textbox that uses a .net regularexpressionvalidator.
    > > If the regular expression fails, is it possible to launch a small
    > > client side javascript function to do something, such as change the
    > > border color of the textbox to red? That would look quite nice: if
    > > the expression fails, the red validator text is shown, plus the
    > > textbox's border goes red.
    > >
    > > TIA,
    > > -dnw.
     
    Peter Blum, May 10, 2004
    #3
    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,295
    Brian Vallelunga
    Jul 31, 2003
  2. VSK
    Replies:
    2
    Views:
    2,305
  3. Bryce Budd

    Regular Expression Validator

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

Share This Page