I was thinking along similar lines, and you are correct about passing the
literal string field name rather than its value.  This is definitely a
Struts thing - almost the exact function call outside of a Struts <html> tag
works fine.

Thanks for the input.

-----Original Message-----
From: Wilson, Les J SI-FSIA [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 21, 2002 12:07 PM
To: 'Struts Users Mailing List'
Subject: RE: html:text indexed gotcha


Hi Mark,

Haven't got an example that does what you need exactly, but when we need to
do something like this, we create a javascript function in either the jsp or
a js file referenced by the jsp that does the actual work - so the confirm
or the window.location processing.  The onchange just calls the function
passing it any parameters required - index and quantity below.  I think the
error you are getting is because quantity being passed is the field name,
not its value - in the js function, you can get the value of the field and
pass that to the window location.

Hope this makes sense.



Les Wilson

Shell Finance Services
Shell International Limited, Shell Centre, London SE1 7NA, United Kingdom

Email: [EMAIL PROTECTED]
Internet: http://www.shell.com


-----Original Message-----
From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
Sent: 21 May 2002 15:59
To: Struts (E-mail)
Subject: html:text indexed gotcha


I've been wrestling with this for the better part of the morning now and,
unfortunately, the Struts documentation is of little help (no examples) and
the archive does not address this that I can find.  Simple put, I have
textfields created dynamically based on a user's previous selection of
accessories and the user must be able to change the quantity of each
accessory.  The closest I've got is a NumberFormatException.  If anybody
knows the correct syntax for the onclick() method within the <html:text>
tag, please post it.
 
<logic:iterate name="orderHeader"
                    property="orderAccessories"
                    indexId="accessoryIndex"
                    id="access"
                    type="com.tessco.partner.ejb.maintenance.Equipment">
  <tr style="background-color:#f9ecca">
    <td>
      <img alt="Remove Item" 
              src="/images/recycle.gif" 
              border=0
              onclick="javascript:if ( confirm( 'Are you sure you want to
remove this accessory?' ) ) 
{ window.location = '/do/removeAccessoryFromCartAction?accessoryIndex=<%=
accessoryIndex %>' }" />
    </td>
    <td>
      <bean:write name="access" property="sku" />
    </td>
    <td>
      &nbsp;&nbsp;&nbsp;&nbsp;
      <bean:write name="access" property="name" />
    </td>
    <td align="center">
      <html:text 
               indexed="yes"
               size="1"
               name="access"
               property="quantity"
               onchange="javascript:window.location = 
                               '/do/saveCart?accessoryIndex=<%=
accessoryIndex %>' +
                               '&quantity=<%= quantity %>'" />
. . .
 
Thanks,
Mark

--
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]>

Reply via email to