struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dansou, Didier" <Didier.Dan...@atoseuronext.net>
Subject Validating multiple selection with built-in validation tags
Date Fri, 02 Jul 2004 08:42:04 GMT
Hello,
 
Can anyone help with this topic?
 
I have a multiple select zone on my form. The user must at least select one value.
I tried to use the validation tag "required" in 2 ways to perform this. But it seems not work.
Here is a snippet of my formBean 
<form-bean name="formuleFormBean"                                                     
     type="org.apache.struts.validator.DynaValidatorForm">
    <form-property name="languesFormuleLibelleIHM"                                   type="java.lang.String[]"/>
</form-bean>
 
Here is a snippet of my first validation.xml 
<formset>
            <form name="formuleFormBean">
                        <field property="languesFormuleLibelleIHM[0]" depends="required">
                                   <msg name="required" key="errors.ihm.formule.langue"/>
                                   <arg0 key="libelle.formule.gestion.langue"/>
                        </field>
            </form>
</formset>
 
Here is a snippet of my second validation.xml 
<formset>
            <form name="formuleFormBean">
                        <field property="languesFormuleLibelleIHM" depends="required">
                                   <msg name="required" key="errors.ihm.formule.langue"/>
                                   <arg0 key="libelle.formule.gestion.langue"/>
                        </field>
            </form>
</formset>
 
When I apply the first validation example and that the user doesn't select a value, I get
the "required message" on my page. But ArrayIndexOutOfBound exceptions are thrown by the framework
validator. 
When I apply the second validation example and that the user doesn't select a value, the "required
message" doesn't appear on my page. 
 
Does someone know a smart way to get this work? 
 
Hope someone may help me with this issue.
 
Thanks in advance.
Didier
 


This e-mail and the documents attached are confidential and intended solely for the addressee;
it may also be privileged. If you receive this e-mail in error, please notify the sender immediately
and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group
liability cannot be triggered for the message content. Although the sender endeavours to maintain
a computer virus-free network, the sender does not warrant that this transmission is virus-free
and will not be liable for any damages resulting from any virus transmitted.

Ce message et les pieces jointes sont confidentiels et reserves a l'usage exclusif de ses
destinataires. Il peut egalement etre protege par le secret professionnel. Si vous recevez
ce message par erreur, merci d'en avertir immediatement l'expediteur et de le detruire. L'integrite
du message ne pouvant etre assuree sur Internet, la responsabilite du groupe Atos Origin ne
pourra etre recherchee quant au contenu de ce message. Bien que les meilleurs efforts soient
faits pour maintenir cette transmission exempte de tout virus, l'expediteur ne donne aucune
garantie a cet egard et sa responsabilite ne saurait etre recherchee pour tout dommage resultant
d'un virus transmis.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message