You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Yariel Ramos Moreno <yr...@ceis.cujae.edu.cu> on 2006/10/09 23:04:35 UTC

Problem with validator framework in LookupDispatchAction

Hi all:

I have a LookupDispatchAction which can be submitted by two buttons (Update and Restore). I need to validate this form only when Update button is pressed. The form field to validate is required and most be integer. The required condition works fine, using the requiredIf validation with a hidden field to check the pressed button (ask for the pressed button and if the value is 1 (Update) then validate, else (value 2 for Restore) don't do anything). If the value in the field is not an integer, the validator framework triggers an exception no matter which button were pressed.

What can I do to make this validation using the validator framework?

Thanks in advance.
__________________________________________

XIII Convención Científica de Ingeniería y Arquitectura
28/noviembre al 1/diciembre de 2006
Cujae, Ciudad de la Habana, Cuba
http://www.cujae.edu.cu/eventos/convencion

Re: Problem with validator framework in LookupDispatchAction

Posted by Laurie Harper <la...@holoweb.net>.
Yariel Ramos Moreno wrote:
> Hi all:
> 
> I have a LookupDispatchAction which can be submitted by two buttons (Update and Restore). I need to validate this form only when Update button is pressed. The form field to validate is required and most be integer. The required condition works fine, using the requiredIf validation with a hidden field to check the pressed button (ask for the pressed button and if the value is 1 (Update) then validate, else (value 2 for Restore) don't do anything). If the value in the field is not an integer, the validator framework triggers an exception no matter which button were pressed.
> 
> What can I do to make this validation using the validator framework?

What exception is triggered? What does the form bean look like? I'm 
guessing that you have a form property declared as 'integer' and the 
exception is occurring when you have non-integer input. In that case, 
try changing for form bean property to String.

If that's not it, post the relevant snippets of configuration, including 
your form bean declaration and implementation, your validation rules and 
relevant JSP code.

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org