You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Glenn, Scott" <Sc...@umusic.com> on 2004/04/29 14:56:30 UTC
Array Validation
I have a form which contains a number of rows of data and am validating each
row using the indexedListProperty validation shown below:-
<form name="RCF">
<field property="newName"
indexedListProperty="rows"
depends="required">
<arg0 key="rename.newName"/>
</field>
</form>
The form bean is basically:-
public class RenameForm extends BaseForm
{
private List rows = null;
. . .
}
where each row element is an instance of
public class RenameFormRow
{
private String oldName = null;
private String newName = null;
. . .
}
Simple stuff...
If I have several rows of data on screen, and I leave ALL the "newName"
fields blank and submit the form, the Struts validator only seems to report
that the first "newName" field is blank. If I enter a value for it and
re-submit, then it detects that the next "newName" field is blank, and so on
....
Normally on form submission all validation would be fully executed, building
up a list of error messages. Does indexedProperty validation work
differently or am I doing something wrong?
Many thanks,
Scott.
Re: Array Validation
Posted by Mark Lowe <ma...@boxstuff.com>.
if you've a getRow(int index) method then
indexedListProperty="row"
I got stumpt on the same as you where i was using the getRows() rather
than getRow(int index).
On 29 Apr 2004, at 14:56, Glenn, Scott wrote:
> I have a form which contains a number of rows of data and am
> validating each
> row using the indexedListProperty validation shown below:-
>
> <form name="RCF">
> <field property="newName"
> indexedListProperty="rows"
> depends="required">
> <arg0 key="rename.newName"/>
> </field>
> </form>
>
> The form bean is basically:-
>
> public class RenameForm extends BaseForm
> {
> private List rows = null;
>
> . . .
> }
>
> where each row element is an instance of
>
> public class RenameFormRow
> {
> private String oldName = null;
> private String newName = null;
> . . .
> }
>
> Simple stuff...
>
> If I have several rows of data on screen, and I leave ALL the "newName"
> fields blank and submit the form, the Struts validator only seems to
> report
> that the first "newName" field is blank. If I enter a value for it and
> re-submit, then it detects that the next "newName" field is blank, and
> so on
> ....
>
> Normally on form submission all validation would be fully executed,
> building
> up a list of error messages. Does indexedProperty validation work
> differently or am I doing something wrong?
>
> Many thanks,
>
> Scott.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Array Validation
Posted by Amin Lalji <am...@intelysis.com>.
Try this in your config...
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/WEB-INF/validation.xml,/WEB-INF/validator-rules.xml"/>
<set-property property="stopOnFirstError" value="false"/>
</plug-in>
The stopOnFirstError might help you out a bit....
/A
-----Original Message-----
From: Glenn, Scott [mailto:Scott.Glenn@umusic.com]
Sent: Thursday, April 29, 2004 7:57 AM
To: 'Struts Users Mailing List'
Subject: Array Validation
I have a form which contains a number of rows of data and am validating each
row using the indexedListProperty validation shown below:-
<form name="RCF">
<field property="newName"
indexedListProperty="rows"
depends="required">
<arg0 key="rename.newName"/>
</field>
</form>
The form bean is basically:-
public class RenameForm extends BaseForm
{
private List rows = null;
. . .
}
where each row element is an instance of
public class RenameFormRow
{
private String oldName = null;
private String newName = null;
. . .
}
Simple stuff...
If I have several rows of data on screen, and I leave ALL the "newName"
fields blank and submit the form, the Struts validator only seems to report
that the first "newName" field is blank. If I enter a value for it and
re-submit, then it detects that the next "newName" field is blank, and so on
....
Normally on form submission all validation would be fully executed, building
up a list of error messages. Does indexedProperty validation work
differently or am I doing something wrong?
Many thanks,
Scott.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org