2007/5/9, Olivier THIERRY <[EMAIL PROTECTED]>:
Hi,

I try to validate a form, but I can't make it work, and I don't understand
why ...

So I have the following form in a JSP :

    <s:actionerror />
    <s:form action="submitCreerDemandeAbsence" id="form1">
        <s:textfield
            id="matriculeDemandeur"
            name="demandeAbsence.matriculeDemandeur"
            label="Matricule"
            onchange="dojo.event.topic.publish('updateInfosDemandeurTopic',
this.value);"
            required="true"
            requiredposition="left"
            />
    </s:form>


My struts.xml file is as following (the action class is Spring managed) :

    <package name="absences" namespace="/absences" extends="struts-default">
        <action name="submitCreerDemandeAbsence"
class="creerDemandeAbsenceAction">
            <interceptor-ref name="defaultStack" />
            <result
name="success">/jsp/absences/confirmerCreationDemandeAbsence.jsp</result>
        </action>
    </package>

And I have the following submitCreerDemandeAbsence-validation.xml file :

<validators>
    <field name="demandeAbsence.matriculeDemandeur">
        <field-validator type="required">
            <message>Vous devez saisir ma matricule du demandeur.</message>
        </field-validator>
    </field>
</validators>


try  <field-validator type="requiredstring">

and add an "input" result to your action results
--
Guillaume Carré

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

Reply via email to