extending the RegularExpressionValidator

Discussion in 'ASP .Net Building Controls' started by Tomk, Jan 14, 2004.

  1. Tomk

    Tomk Guest

    I would like to have a RegularExpressionValidator that would also require an
    entry. So I opened Reflector and looked at the RegularExpressionValidator
    control and found the EvaluateIsValid function. In this function it returns
    a true if the ControlToValidate is empty. OK so my thought was to extend
    this control, add a 'Required' property and override the EvaluateIsValid
    function. Then return false if the 'Required' property is set and the
    ControlToValidate is empty. This all seem to work just fine and on my test
    program it seemed to work. However in real practice I found that if the
    ControlToValidate was empty the form was still submitted. So is seems I
    have to dig into the JScript generated by the control. Am I going in the
    right direction? What do I override to change the JScript?
     
    Tomk, Jan 14, 2004
    #1
    1. Advertisements

  2. hi Tom,
    Surely these articles will help you. It should put you in the right
    direction if your looking to extend validator controls.

    http://msdn.microsoft.com/library/d...uide/html/cpconsupportingup-levelbrowsers.asp

    http://msdn.microsoft.com/library/d...onregularexpressionvalidatorcontrolsample.asp

    http://msdn.microsoft.com/library/d...cpguide/html/cpconvalidatorcontrolsamples.asp


    "Tomk" <> wrote in message
    news:%...
    > I would like to have a RegularExpressionValidator that would also require

    an
    > entry. So I opened Reflector and looked at the RegularExpressionValidator
    > control and found the EvaluateIsValid function. In this function it

    returns
    > a true if the ControlToValidate is empty. OK so my thought was to extend
    > this control, add a 'Required' property and override the EvaluateIsValid
    > function. Then return false if the 'Required' property is set and the
    > ControlToValidate is empty. This all seem to work just fine and on my

    test
    > program it seemed to work. However in real practice I found that if the
    > ControlToValidate was empty the form was still submitted. So is seems I
    > have to dig into the JScript generated by the control. Am I going in the
    > right direction? What do I override to change the JScript?
    >
    >
     
    Alessandro Zifiglio, Jan 14, 2004
    #2
    1. Advertisements

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. Oleg Ogurok
    Replies:
    1
    Views:
    6,567
    William F. Robertson, Jr.
    Jun 25, 2003
  2. Helixpoint

    RegularExpressionValidator for money??

    Helixpoint, Jun 30, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,983
    Helixpoint
    Jul 1, 2003
  3. Salim Afþar

    regularexpressionvalidator numeric control

    Salim Afþar, Aug 4, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,687
    Vincent V
    Aug 5, 2003
  4. BH
    Replies:
    0
    Views:
    667
  5. Ananda Sim
    Replies:
    0
    Views:
    601
    Ananda Sim
    Aug 18, 2003
  6. MS Newsgroups

    Help with regularexpressionvalidator

    MS Newsgroups, Oct 17, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    535
    MS Newsgroups
    Oct 17, 2003
  7. Mark Dengler

    RegularExpressionValidator help

    Mark Dengler, Nov 20, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    2,002
    Mark Dengler
    Nov 24, 2003
  8. Ricardo Corsi P. Cesar

    how to create a RegularExpressionValidator in runtime ? ?

    Ricardo Corsi P. Cesar, Nov 26, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    4,346
    Nick Hertl
    Dec 15, 2003
Loading...