C
Claire
I have Validator installed and working, I can validate the input on a
logon form correctly. However, logon form is a straight forward form
as in it simply has 3 strings (from struts-config.xml):
<form-bean name="logonForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="username" type="java.lang.String"/>
<form-property name="password" type="java.lang.String"/>
<form-property name="type" type="java.lang.String"/>
</form-bean>
. . . but my problem is now when I have a form set up that contains
an array of objects, and trying to validate the input of one of the
properties of the object (from struts-config.xml):
<form-bean name="stockForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="rows" type="app.Stock.StockRow[]"/>
<form-property name="action" type="java.lang.String"/>
</form-bean>
with StockRow consisting of (from StockRow.java):
private String code = "";
private String name = "";
private String depot = "";
private String depotId = "";
private String rrp = "";
private String price = "";
private String activeDate = "";
private String inactiveDate = "";
private String currentStock = "";
private String newStock = "";
So when I display the form in the jsp, I display many 'StockRow'
objects, each of the texts being indexed . . .
. . . so what I want to do is check that all of the 'newStock' fields
contain an integer, so I tried (from validation.xml):
<form name="stockForm">
<field property="newStock"
depends="integer">
<arg0 key="prompt.newStock"/>
</field>
</form>
along with changing:
property="rows.newStock"
property="app.Stock.StockRow.newStock"
but nothing is making the form validate that newStock contains an
integer value. Has anybody got any ideas as to what I need to do?
Many Thanks, Claire
logon form correctly. However, logon form is a straight forward form
as in it simply has 3 strings (from struts-config.xml):
<form-bean name="logonForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="username" type="java.lang.String"/>
<form-property name="password" type="java.lang.String"/>
<form-property name="type" type="java.lang.String"/>
</form-bean>
. . . but my problem is now when I have a form set up that contains
an array of objects, and trying to validate the input of one of the
properties of the object (from struts-config.xml):
<form-bean name="stockForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="rows" type="app.Stock.StockRow[]"/>
<form-property name="action" type="java.lang.String"/>
</form-bean>
with StockRow consisting of (from StockRow.java):
private String code = "";
private String name = "";
private String depot = "";
private String depotId = "";
private String rrp = "";
private String price = "";
private String activeDate = "";
private String inactiveDate = "";
private String currentStock = "";
private String newStock = "";
So when I display the form in the jsp, I display many 'StockRow'
objects, each of the texts being indexed . . .
. . . so what I want to do is check that all of the 'newStock' fields
contain an integer, so I tried (from validation.xml):
<form name="stockForm">
<field property="newStock"
depends="integer">
<arg0 key="prompt.newStock"/>
</field>
</form>
along with changing:
property="rows.newStock"
property="app.Stock.StockRow.newStock"
but nothing is making the form validate that newStock contains an
integer value. Has anybody got any ideas as to what I need to do?
Many Thanks, Claire