You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Lukasz Lenart <lu...@apache.org> on 2015/10/21 11:53:00 UTC
Re: form-xml-validation sample / boolean validator / over21
2015-10-21 10:41 GMT+02:00 Chris <ch...@yahoo.fr>:
> Struts 2.5 BETA2 / form-xml-validation sample / boolean validator /
>
> Hello,
> https://github.com/apache/struts-examples/blob/master/form-xml-validation/src/main/webapp/edit.jsp
> The edit.jsp file contains this line <s:checkbox key="personBean.over21" />
> but the file EditAction-validation.xml doesn't contain a validation for this boolean.
>
> How I could use in the EditAction-validation.xml
> the good one validation for a boolean ?Could be also very usefull with an agree/disagree checkbox
PRs are always welcome :) Anyway the 'required' validator should be enough
http://struts.apache.org/docs/required-validator.html
and also I would prefer to use Radio buttons instead of the checkbox
to force user to make a choice
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
Re: form-xml-validation sample / boolean validator / over21
Posted by Chris <ch...@yahoo.fr>.
Obviously I am speaking to other users as is the case for me, do not have too much knowledge of the use of these functions. Not to the Struts conceptors.;-)Be carreful, double equal sign is good for comparaison,...
Le Mercredi 21 octobre 2015 16h15, Chris <ch...@yahoo.fr> a écrit :
Hi,Thank, It works with fieldexpression.
I tried this :
<validator type="fieldexpression">
<param name="fieldname">personBean.over21</param>
<param name="expression"><![CDATA[personBean.over21 == true]]></param>
<message>You must be 21 or older</message>
</validator>
Be carreful, double egal sign is good for comparaison, but only one egal sign is an affectation !
= = = = = = = = = = = = = = = = = = = = = = = = = = =
I tried also the inverse : with
<param name="expression"><![CDATA[personBean.over21 == false]]></param>
<message>You must be under 21</message>
And it works too !
Le Mercredi 21 octobre 2015 12h39, Lukasz Lenart <lu...@apache.org> a écrit :
2015-10-21 12:22 GMT+02:00 Chris <ch...@yahoo.fr>:
> Hi,
>
> I don't know what PRs means. :-)
PR means Pull Request on GitHub - a change from some other user
> I already tried "required" with checkbox, but it doesn't work.
> <validator type="required">
> <param name="fieldname">personBean.over21</param>
> <message>You must be 21 or older</message>
> </validator>
>
> ...( checked or not is always OK)
interesting ... try with
http://struts.apache.org/docs/fieldexpression-validator.html
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
Re: form-xml-validation sample / boolean validator / over21
Posted by Chris <ch...@yahoo.fr>.
Hi,Thank, It works with fieldexpression.
I tried this :
<validator type="fieldexpression">
<param name="fieldname">personBean.over21</param>
<param name="expression"><![CDATA[personBean.over21 == true]]></param>
<message>You must be 21 or older</message>
</validator>
Be carreful, double egal sign is good for comparaison, but only one egal sign is an affectation !
= = = = = = = = = = = = = = = = = = = = = = = = = = =
I tried also the inverse : with
<param name="expression"><![CDATA[personBean.over21 == false]]></param>
<message>You must be under 21</message>
And it works too !
Le Mercredi 21 octobre 2015 12h39, Lukasz Lenart <lu...@apache.org> a écrit :
2015-10-21 12:22 GMT+02:00 Chris <ch...@yahoo.fr>:
> Hi,
>
> I don't know what PRs means. :-)
PR means Pull Request on GitHub - a change from some other user
> I already tried "required" with checkbox, but it doesn't work.
> <validator type="required">
> <param name="fieldname">personBean.over21</param>
> <message>You must be 21 or older</message>
> </validator>
>
> ...( checked or not is always OK)
interesting ... try with
http://struts.apache.org/docs/fieldexpression-validator.html
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
Re: form-xml-validation sample / boolean validator / over21
Posted by Lukasz Lenart <lu...@apache.org>.
2015-10-21 12:22 GMT+02:00 Chris <ch...@yahoo.fr>:
> Hi,
>
> I don't know what PRs means. :-)
PR means Pull Request on GitHub - a change from some other user
> I already tried "required" with checkbox, but it doesn't work.
> <validator type="required">
> <param name="fieldname">personBean.over21</param>
> <message>You must be 21 or older</message>
> </validator>
>
> ...( checked or not is always OK)
interesting ... try with
http://struts.apache.org/docs/fieldexpression-validator.html
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
Re: form-xml-validation sample / boolean validator / over21
Posted by Chris <ch...@yahoo.fr>.
Hi,
I don't know what PRs means. :-)
I already tried "required" with checkbox, but it doesn't work.
<validator type="required">
<param name="fieldname">personBean.over21</param>
<message>You must be 21 or older</message>
</validator>
...( checked or not is always OK)
In my opinion, I would prefer to use Checkbox instead of the Radio buttons
to give user to make a choice when agree/disagree or 21 or older. Regards,
chris
Le Mercredi 21 octobre 2015 11h53, Lukasz Lenart <lu...@apache.org> a écrit :
2015-10-21 10:41 GMT+02:00 Chris <ch...@yahoo.fr>:
> Struts 2.5 BETA2 / form-xml-validation sample / boolean validator /
>
> Hello,
> https://github.com/apache/struts-examples/blob/master/form-xml-validation/src/main/webapp/edit.jsp
> The edit.jsp file contains this line <s:checkbox key="personBean.over21" />
> but the file EditAction-validation.xml doesn't contain a validation for this boolean.
>
> How I could use in the EditAction-validation.xml
> the good one validation for a boolean ?Could be also very usefull with an agree/disagree checkbox
PRs are always welcome :) Anyway the 'required' validator should be enough
http://struts.apache.org/docs/required-validator.html
and also I would prefer to use Radio buttons instead of the checkbox
to force user to make a choice
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