Hi All,

I have a JSP page where on the select of a radio button some controls are
disabled/enabled. The form bean associated with this JSP extends
ValidatorForm. I have created rules in validation-xml for each of these
controls which are there on the screen. One rule that is common to all the
controls is -"required".

Depending on the selection of the radio button different methods in a
DispatchAction class are called. If i need to do server side validations
then how can i prevent the validator framework to validate controls which
have been disabled.

For client side validations i can just do some slight modifications in
validation-rules.xml and get the behavior i want.

For server side validations of this kind i can think of the following:
1. Override the apache class that provides the "required" behavior, then
change validator-rules.xml to have the custom class instead.
2. override the validate method in the form bean and based on the request
attributes get only errors for the controls that are enabled. - Somehow this
method though simple fix does not appeal to me much.

What can be the best way in which this can be acheived.

One more thing:

Does struts provide you a way in which you can check in a form bean whether
a control was disabled. The behavior that i observed is that if the control
is disabled then the value in the form bean is null. Which is also the case
when the user does not enter anything in the control.

Regards,
madhav



--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do

Reply via email to