Tech Off Thread

4 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

ASP Validator to validate three controls with "AND" actions.

Back to Forum: Tech Off
  • User profile image
    jsampsonPC

    Is it possible to validate whether or not three textboxes have been filled out. I know I could do this with vb.net, but I'm wondering if there is an ASP.NET validator that already does this?

    Reason I'm asking. I have a form I'm making where people can input their SSN.. It's three textboxes seperated by -. I don't want to make three validators - one for each box.

  • User profile image
    W3bbo

    I'm afraid you do, each System.Web.UI.Controls.BaseValidator can be bound to only one input control.

    Well, you might be able to create a subclass and experiment, but I haven't tried that.

  • User profile image
    jsampsonPC

    The compare validator binds to two controls, no?
    I suppose I could write a new control that works similar to the compare-validator...


  • User profile image
    Ang3lFir3

    jsampsonPC wrote:
    The compare validator binds to two controls, no?
    I suppose I could write a new control that works similar to the compare-validator...


    you could better still write your own control as a SSN control and build in support for validating it all together......

    other than that a regex validator on a hidden input that is updated whenever the text changes....

    or use a regex validator on a single control instead of 3 fields so the values can be keyed in using a 10key without having to hit Tab or click to the next input.... there are several (i think even free) web controls that support configurable input masks.....

    just some ideas...

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.