The Change() method is rather doing nothing, just modifying a flag :
<script type="text/javascript">
function Change(){
        document.forms[0].change.value = '1';
}
</script>

My validattion xml is simple, it is just a requiredstring on the select 
item :
<validators>
    <field name="familleProduit.nomFamille">
        <field-validator type="requiredstring">
                <param name="trim">true</param>
            <message key="errors.required"/>
        </field-validator>
    </field>
    <field name="familleProduit.chargeTravail">
        <field-validator type="double">
            <message key="errors.double"/>
        </field-validator>
    </field>
    <field name="familleProduit.gamme.idGamme">
        <field-validator type="requiredstring">
                <param name="trim">true</param>
            <message key="errors.required"/>
        </field-validator>
    </field>
</validators>




Laurie Harper <[EMAIL PROTECTED]> 
Envoyé par : news <[EMAIL PROTECTED]>
04/08/2007 00:50
Veuillez répondre à
"Struts Users Mailing List" <user@struts.apache.org>


A
user@struts.apache.org
cc

Objet
Re: [S2] Problem of validation with a select in my form






Sounds like an error in your validation rules, which you haven't listed, 
or possibly a result of whatever your Change() JavaScript function is 
doing. Without seeing all the pieces, it's difficult to diagnose.

L.

[EMAIL PROTECTED] wrote:
> Hi,
> 
> I have a select list in my form, and when I submit the form, the 
> javascript client validation passes, but the server validation failed. 
It 
> comes back to my JSP with the "required field" error message.
> 
> The weird thing is that in my action the field is well filled (I put a 
> breakpoint in an empty validate() method), and when it comes back to the 

> JSP the selected option of my select is what I submitted. So why the 
> server validation doesn't see that the select is filled ?
> 
> <s:form action="familleProduitGerer_save" validate="true" theme="xhtml">
>         <s:select name="familleProduit.gamme.idGamme"
>                 id="familleProduit.gamme.idGamme"
>                 list="gammes"
>                 listKey="idGamme"
>                 listValue="libelle"
>                 emptyOption="true"
>                 required="true"
>                 onchange="javascript: Change();"/>
> </s:form>
> 
> public class FamilleProduitVO extends CRUDVO {
>         private long idFamille;
>         private String nomFamille = "";
>         private Double chargeTravail;
>         private String urlFamille = "";
>         private GammeVO gamme;
> 
>         ...
> }
> public class GammeVO extends CRUDVO {
>         private long idGamme;
>         private String libelle;
>         private String urlGamme;
> 
>         ...
> }
> public class FamilleProduitGererAction extends CRMAction {
>         private FamilleProduitVO familleProduit;
>         private List<GammeVO> gammes;
> 
>         ...
> }
> 
> Thanks for your help.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to