struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <lukaszlen...@apache.org>
Subject Re: How to validate multiple fields with the same name
Date Mon, 25 Mar 2013 18:43:26 GMT
2013/3/25 Muralidhar Yaragalla <java.yaragalla@gmail.com>:
> Hi Thanks for this.But i am aware of this info I mean the normal validation
> methods. I repeat and the important point is that all the 4 fields i have
> contains the same name so how do i do that in an xml. I know that it can be
> done inside valiadtion() method. I thought so much but it looks impossible
> for me to do in validation.xml file using validators.

But in action is just one field? eg. private List<String> values? So
the field name is values and you can use expression validator to have
at least to fields filled:

	<field name="values">
		<field-validator type="fieldexpression">
			<param name="expression">(values.size > 1)</param>
			<message><![CDATA[ at least two values are required ]]></message>
		</field-validator>
	</field>


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


Mime
View raw message