You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Srikanth Goud <sr...@lntinfotech.com> on 2009/02/07 07:38:52 UTC

validations with selected option

Hi,
    
   Iam writing validations in className-validation.xml file it is working
fine.
   But in the form there are two radio buttons
   1. If one is selected a new table appear on the form with 5 or 6 fields
and vice versa.
 
      I written the validaions for all the fields including the table which
is appending on selecting one of the option.So,these validations are fired
automatically when user clicks on next button.

Know my question how to stop firing validations for the table(with 5 or 6
fields)when the user has not selected the paritcular option.

 Srikanth
-- 
View this message in context: http://www.nabble.com/validations-with-selected-option-tp21885572p21885572.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: validations with selected option

Posted by Dave Newton <ne...@yahoo.com>.
Srikanth Goud wrote:
> Hi,
>    Still i don't have any idea for this.
>    Could you pls provide a solution

Complex validations are generally easier to handle in an action's 
validate() method--it's *possible* to do via XML or annotations, but 
personally I find it a little unwieldy.

>>    But in the form there are Two Tables with some fields. And at a time
>> only one table will be on page depedning on the user selected option.
>> Written validations for all fields in the first table and second table.
>>
>> so, if user selects his option than for only those fields validations
>> should fire.
>> But here the validations are firing for the first table and second table.
>> How should i stop the validations?

You'll have to have some mechanism for determining which form elements 
have been filled in. Depending on how you're switching between elements 
it may be easiest to do this via JavaScript, setting an additional 
hidden value indicating which group of elements the validation should 
pay attention to.

If only one set of forms is actually *submitted* then it can be as 
simple as checking for the presence of a required form parameter.

If there are shared form elements that require simplistic validation 
it's easy to use XML- or annotation-driven validation in addition to the 
custom validation by calling super.validate().

Dave

https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3211397


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


Re: validations with selected option

Posted by Srikanth Goud <sr...@lntinfotech.com>.
Hi,
   Still i don't have any idea for this.
   Could you pls provide a solution

 Srikanth



Srikanth Goud wrote:
> 
> Hi Friends,
>     
>    Iam writing validations in className-validation.xml file it is working
> fine.
>    
>    But in the form there are Two Tables with some fields. And at a time
> only one table will be on page depedning on the user selected option.
> Written validations for all fields in the first table and second table.
> 
> so, if user selects his option than for only those fields validations
> should fire.
> But here the validations are firing for the first table and second table.
> How should i stop the validations?
> 
> 
>    
> 
>  Srikanth
> 

-- 
View this message in context: http://www.nabble.com/validations-with-selected-option-tp21885572p21976047.html
Sent from the Struts - User mailing list archive at Nabble.com.


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