Custom validator on multiple fields?

Discussion in 'ASP .Net' started by Tarun Mistry, Feb 12, 2006.

  1. Tarun Mistry

    Tarun Mistry Guest

    Hi everyone, is it possible to make a custom validator work on multiple
    fields?

    I have 3 input text boxes, I would like a validator that checks to ensure at
    least 1 of them contains informaion before allowing the form to be
    submitted.

    Any help apprecated,

    Kind regards
    Taz
     
    Tarun Mistry, Feb 12, 2006
    #1
    1. Advertising

  2. Tarun Mistry

    Teemu Keiski Guest

    Hi,

    you can use CustomValidator so that don't specify the ControlToValidate at
    all. In that case, you'd sort of hard-code in the validation logic which
    controls you check for with it. That way you can check multiple of them.

    I've also developed (though a long time ago, so the quality of code is what
    it is) such validator which can take the controls to be validated as
    comma-separated string
    http://authors.aspalliance.com/joteke/validationarticle1/article.aspx

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    http://blogs.aspadvice.com/joteke


    "Tarun Mistry" <> wrote in message
    news:%...
    > Hi everyone, is it possible to make a custom validator work on multiple
    > fields?
    >
    > I have 3 input text boxes, I would like a validator that checks to ensure
    > at least 1 of them contains informaion before allowing the form to be
    > submitted.
    >
    > Any help apprecated,
    >
    > Kind regards
    > Taz
    >
     
    Teemu Keiski, Feb 12, 2006
    #2
    1. Advertising

  3. Tarun Mistry

    Tarun Mistry Guest

    Many thanks Teemu, this is exactly what I needed.

    Appreciate your help.

    Regards
    Taz
     
    Tarun Mistry, Feb 12, 2006
    #3
  4. Tarun Mistry

    sofiat9

    Joined:
    Mar 24, 2008
    Messages:
    2
    Hi Teemu, I added the code above to my vb.net project. I need to make user the user enters at least one of 3 textfield values. However, I'm getting the following two errors: Error1 Element 'EmptyControlCompareValidator' is not a known element. This can occur if there is a compilation error in the Web site. Error2 Unknown server tag 'asp:EmptyControlCompareValidator'. Any help would be appreciated. Thanks! Sofia :)
     
    sofiat9, Mar 24, 2008
    #4
  5. Tarun Mistry

    sofiat9

    Joined:
    Mar 24, 2008
    Messages:
    2
    Hi, I added the code above to my vb.net project. I need to make user the user enters at least one of 3 textfield values. However, I'm getting the following two errors: Error1 Element 'EmptyControlCompareValidator' is not a known element. This can occur if there is a compilation error in the Web site. Error2 Unknown server tag 'asp:EmptyControlCompareValidator'.

    I added the following code as well on the top of my source code:

    <%@ Register Assembly="EmptyControlCompareValidator" Namespace="MansoftValidators" TagPrefix="cc1" %>

    Any help would be appreciated. Thanks! Sofia
     
    sofiat9, Mar 25, 2008
    #5
    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. Patrick.O.Ige
    Replies:
    1
    Views:
    388
  2. Replies:
    4
    Views:
    936
    Richter~9.6
    Feb 13, 2007
  3. Scott Yenor

    How to get custom control to work with custom validator

    Scott Yenor, Jan 27, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    227
    Scott Yenor
    Jan 27, 2004
  4. JP SIngh
    Replies:
    5
    Views:
    279
    Bob Barrows [MVP]
    Jan 24, 2006
  5. Replies:
    0
    Views:
    304
Loading...

Share This Page