Subject: Struts Validation - Stop on fail?
From: "Andrej Sobkowski" <[EMAIL PROTECTED]>
 ===
Hello,

I've been using the Struts Validator on a couple of projects with no pbs but
I'm now stuck with a (probably easy-to-solve) issue. I have a super-basic
bean with 3 properties: name, density, concentration. Both density and
concentration are required and must be float. My validation.xml is shown
below... standard, easy, nothing special.

The problem is that if I enter an invalid concentration (not a float) and I
leave density empty, I only get one message saying: "Density is required"
(no mention about the invalid concentration). If I then enter invalid
concentration and density, I get the proper results ("Density must be a
float. Concentration must be a float"). It looks like the "required" gets
the priority on the other validations. Is this normal?

Does anybody have any ideas about what I'm doing wrong? I'm pretty sure it's
something minor...

Thanks.

Andrej


I'm working with Struts 1.1b1 with Tomcat 4.0.4 under Win2k.

<!-- bottom of struts-config.xml -->
  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathname" value="/WEB-INF/validator-rules.xml"/>
    <set-property property="pathname"
value="/WEB-INF/slb-validator-rules.xml"/>
    <set-property property="pathname" value="/WEB-INF/validation.xml"/>
  </plug-in>

<!-- validation.xml -->
<form-validation>
  <formset>
    <form    name="baseFluidForm">
      <field property="name"
             depends="required">
        <arg0 key="name"/>
      </field>
      <field property="density"
             depends="required,float">
        <arg0 key="density"/>
      </field>
      <field property="concentration"
             depends="required,float">
        <arg0 key="concentration"/>
      </field>
    </form>
    </form>
  </formset>
</form-validation>




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

Reply via email to