I'm running into a problem with validators in T4. I have a situation where I
sometimes need to validate a field on a form, but only if another field on
the same form has a certain set of values. For example, a "ship quantity"
field on an order form is only required if the order delivery method is
"shipment" and not "download" (you don't have a ship quantity for an order
that doesn't ship). Again, both fields are on the same form.
Maybe I'm missing something but I don't know how to make the use of a
validator conditional. I don't want to do manual validation in the submit
method. I've tried setting the "validators" of the text field to a method on
the page class that checks the field values, but it seems that the
validation does not have access to the runtime selection made by the user.
In other words, at the time my method tries to check if a validator is
necessary, it is looking at old data and doesn't have access to the value
the user was trying to submit. Something related to when in the page cycle
validation is checked, I'm sure.

Any ideas? This is for server-side validation, though of course client-side
validation would be really nice too! (I imagine that would have to be using
some sort of async callback method).

Reply via email to