While I can't help you with the DynaValidator stuff, the arg0, arg1 are used to pass
strings into your error messages. For example the error message for maxlength is
errors.maxlength={0} can not be greater then {1} characters.
<arg0> is replaced for the {0} and likewise with <arg1> for {1}
Thus when you have the following in your validation.xml:
<field property="lastName"
depends="required,maxlength">
<arg0 key="registrationForm.lastname.displayname"/>
<arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
<var>
<var-name>maxlength</var-name>
<var-value>10</var-value>
</var>
</field>
and your ApplicationResources.properties:
registrationForm.lastname.displayname=Last name
Your error message would be
Last name can not be greater then 10 characters.
This was taken from the struts-validator.war in 1.1-b2
-Devin
-----Original Message-----
From: John Nicholas [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 25, 2002 11:42 AM
To: Struts Users Mailing List
Subject: Validator and DynaValidatorForm
I'm using the DynaForm / Validator stuff for the first time, I've always
written out the Forms and Actions before. Everything seems in place but
the Validator never catches an error and the submit always succeeds.
from struts-config.xml:
<form-bean
name="testbean"
dynamic="true"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property
name="tname"
type="java.lang.String"/>
<form-property
name="tage"
type="java.lang.String"/>
<form-property
name="tphone"
type="java.lang.String"/>
</form-bean>
and
<action
path="/testformSubmit"
name="testbean"
type="ActionTest"
input="/WEB-INF/jsp/testform.jsp"
scope="request"
parameter="test"
validate="true" >
<forward name="success" path="/pages/Welcome.jsp"/>
</action>
and
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validator.xml" />
</plug-in>
from validation.xml:
<formset>
<form name="testbean">
<field property="tage" depends="required,integer">
</field>
</form>
</formset>
I've tried various things in validation as far as changing up <arg0>
settings. I'm very unclear on what the <arg#> settings are for though
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>