struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José Antonio Delgado Trujillo <jadt...@gmail.com>
Subject validation checkboxlist
Date Wed, 03 Jan 2018 09:30:12 GMT
I have a form with a checkboxlist linked to a bean with an array of string properties. I want
the user must select at least one option.

Looking for the documentation, i think this is possible with field expression, but it requires
ONGL expression.

I did it so:

FORM

<s:form action=“register”>
…
   <s:checkboxlist key=levels/>
…
</s:form>


BEAN 
public class Person{

    private String[] levels;
…
}


XML VALIDATION
<validator>
   <field name=person.levels>
	<field-validator type=fieldexpression>
            <param name=“expression”><![CDATA[person.levels.length==0]]></param>
            <message>Selecciona al menos un curso</message>
       </field-validator>
  </field>
</validator

After that the first submit without selection i see the error field message. But if i select
one options and submit i still see the error. Why??




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


Mime
View raw message