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. Advertising

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

    RegularExpressionValidator for money??

    Helixpoint, Jun 30, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,749
    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,562
    Vincent V
    Aug 5, 2003
  4. BH
    Replies:
    0
    Views:
    508
  5. Ananda Sim
    Replies:
    0
    Views:
    479
    Ananda Sim
    Aug 18, 2003
Loading...

Share This Page