Just forgot to explain that I do the following:

<field property="property(user-username)"...

because user-username is the name of one of my properties (fields) on
the form. In your case it would be something like:

<field property="volume(<fieldname>)"...

Erez


-----Original Message-----
From: Erez Efrati [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 06, 2003 11:44 AM
To: 'Struts Users Mailing List'
Subject: RE: Using Struts Validator on Map-backed ActionForms

Hi Panchasheel,

I am working with map backed action forms and the way to work with
validation in this case is as follows (a piece of my validation.xml):

(on my ActionForm there are getProperty and setProperty interfacing the
actual map - as in your case I guess it is 'getVolume() and
setVolume()).


                        <!-- username -->
                        <field  property="property(user-username)"
                                        depends="required, mask">
                                        <msg name="mask"
key="logon.username.maskMsg"/>
                                        <arg0 key="logon.username"/>
                                        <var>
        
<var-name>mask</var-name>
        
<var-value>${username}</var-value>
                                        </var>
                        </field>

Hope this helps,
Erez


-----Original Message-----
From: Gandle, Panchasheel [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 06, 2003 4:48 AM
To: 'Struts Users Mailing List'
Subject: RE: Using Struts Validator on Map-backed ActionForms

Has anybody come up with any validations for map-backed fields

<field property="???"
   depends="required">
   <arg0 key=""/>
</field>

what should go in ???
for 
<% for (int i=0;i<5;i++;) { %>
<html:text property="volume(key<%=i%>)" value=""/>
<% } %>

Thanks
Panchasheel


-----Original Message-----
From: Cordingley, Charles [mailto:[EMAIL PROTECTED]
Sent: Friday, August 01, 2003 1:24 PM
To: '[EMAIL PROTECTED]'
Subject: Using Struts Validator on Map-backed ActionForms


Hi,

I am trying to use the Struts Validator to generate Javascript
validation on
a Map-backed action form, but I keep getting "type is null or not an
object"
javascript error (I am using Struts 1.1). Non map-backed properties on
the
form work fine.

In the JSP I am creating text boxes using:

<html:text style="WIDTH: 75px; text-align: right"
property='<%="volume("+act.getActivityID()+")"%>'
value='<%=""+scenAct.getActivityVolume()%>'/>

and have this method on the action form to get it:

public void setVolume(String key, Object value) {
   volumes.put(key, value);
}

In the validation.xml I have tried:

<field property="volume()"
   depends="required">
   <arg0 key=""/>
</field>

and:

<field property="volume()"
   depends="required">
   <arg0 key=""/>
</field>

but both result in the error.

Does anyone know how to do this?

Thanks,
Charles.



The Royal Bank of Scotland plc ('the Bank') is regulated by the
Financial 
Services Authority and is a member of The Royal Bank of Scotland
Marketing
Group.  The only packaged products (life policies, unit trusts and other
collective investment schemes and stakeholder and other pensions) the
Bank
advises on and sells are those of the Marketing Group, whose other
members
are Royal Scottish Assurance plc and Royal Bank of Scotland Unit Trust
Management Limited, both regulated by the Financial Services Authority.

The Royal Bank of Scotland plc. Registered in Scotland No 90312.
Registered
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 

Agency agreements exist between members of The Royal Bank of Scotland
Group.

This e-mail message is confidential and for use by the addressee only.
If
the message is received by anyone other than the addressee, please
return
the message to the sender by replying to it and then delete the message
from
your computer. Internet e-mails are not necessarily secure. The Royal
Bank
of Scotland plc does not accept responsibility for changes made to this
message after it was sent. 

Whilst all reasonable care has been taken to avoid the transmission of
viruses, it is the responsibility of the recipient to ensure that the
onward
transmission, opening or use of this message and any attachments will
not
adversely affect its systems or data. No responsibility is accepted by
The
Royal Bank of Scotland plc in this regard and the recipient should carry
out
such virus and other checks as it considers appropriate.


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

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



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




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

Reply via email to