Discussion:
Custom validator on multiple fields?
(too old to reply)
Tarun Mistry
19 years ago
Permalink
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
19 years ago
Permalink
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
Post by Tarun Mistry
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
19 years ago
Permalink
Many thanks Teemu, this is exactly what I needed.

Appreciate your help.

Regards
Taz

Continue reading on narkive:
Loading...