You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Rous, Simon" <si...@csfb.com> on 2004/03/08 14:54:14 UTC

Struts Form Validation

I'm letting the user of my form build up entry fields as they need them - ie :

<logic:iterate id="trade" name="requestForm" property="tradeColl"
indexId="ctr" >
<html-el:text property="tradeQuantity[${trade}]" />
</logic:iterate>

giving form fields .......

<input type=text name=tradeQuantity[0]>
<input type=text name=tradeQuantity[1]>
<input type=text name=tradeQuantity[2]>
etc ...

How can I use validation.xml to validate these fields when I don't know if a
field exists on a page ? 

         <field property="tradeQuantity[0]" depends="integer" page="3">
            <arg0 key="request.tradequantity.displayname"/>
         </field>
         --- repeated for each field - but I don't know how many the user will
select --------

Maybe I should use the validate method inside the ActionForm and handle these
fields manually ?

Thanks for any help.

-Simon


==============================================================================
This message is for the sole use of the intended recipient. If you received
this message in error please delete it and notify us. If this message was
misdirected, CSFB does not waive any confidentiality or privilege. CSFB
retains and monitors electronic communications sent through its network.
Instructions transmitted over this system are not binding on CSFB until they
are confirmed by us. Message transmission is not guaranteed to be secure.
==============================================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Struts Form Validation

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
You can specify a "indexedListProperty" in the validation.xml

         <field property="tradeQuantity" indexedListProperty="myCollection"
depends="integer" page="3">
            <arg0 key="request.tradequantity.displayname"/>
         </field>

Niall

----- Original Message ----- 
From: "Rous, Simon" <si...@csfb.com>
To: <st...@jakarta.apache.org>
Sent: Monday, March 08, 2004 1:54 PM
Subject: Struts Form Validation


> I'm letting the user of my form build up entry fields as they need them -
ie :
>
> <logic:iterate id="trade" name="requestForm" property="tradeColl"
> indexId="ctr" >
> <html-el:text property="tradeQuantity[${trade}]" />
> </logic:iterate>
>
> giving form fields .......
>
> <input type=text name=tradeQuantity[0]>
> <input type=text name=tradeQuantity[1]>
> <input type=text name=tradeQuantity[2]>
> etc ...
>
> How can I use validation.xml to validate these fields when I don't know if
a
> field exists on a page ?
>
>          <field property="tradeQuantity[0]" depends="integer" page="3">
>             <arg0 key="request.tradequantity.displayname"/>
>          </field>
>          --- repeated for each field - but I don't know how many the user
will
> select --------
>
> Maybe I should use the validate method inside the ActionForm and handle
these
> fields manually ?
>
> Thanks for any help.
>
> -Simon
>
>
>
============================================================================
==
> This message is for the sole use of the intended recipient. If you
received
> this message in error please delete it and notify us. If this message was
> misdirected, CSFB does not waive any confidentiality or privilege. CSFB
> retains and monitors electronic communications sent through its network.
> Instructions transmitted over this system are not binding on CSFB until
they
> are confirmed by us. Message transmission is not guaranteed to be secure.
>
============================================================================
==
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org