• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

retrieve value of a field

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using DynaActionForm. I am creating a bean of size 10 an iterating it over in my jsp to create 10 text fields. My bean contains 4 fields.

So basically there are 4 columns(Prod Desc, Nett Price, Quantity and UOM) in a row and there are 10 such rows. UOM is one such column which is a drop down.

What i want is: If the user selects any value from the UOM drop down then all the 10 UOM text fields should be filled with the value selected.

struts-config :
<form-bean name="purchaseOrderBeanForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="lines" type="ActionForm.AddPOBean[]" size="10" />
<form-property name="selected" type="java.lang.String" />
<form-property name="arrCustID" type="java.util.ArrayList" />
<form-property name="UOM" type="java.lang.String" />
<form-property name="POB2B" type="java.lang.String" />
<form-property name="POTX" type="java.lang.String" />
<form-property name="PONO" type="java.lang.String" />
</form-bean>

my jsp:

<tr>
<td >S/No.</td>
<td > Product Description</td>
<td >Nett Price (Without Tax)</td>
<td>Quantity</td>
<td>  UOM </td>
<td><html:select property="UOM" onchange="changeValue(this.value);">
<html:option value="nos."></html:option>
<html:option value="kg"></html:option>
</html:select>
</td>
</tr>
<% int i = 1; %>
<logic:iterate id="lines" name="purchaseOrderBeanForm" property="lines">
<tr>
<td><%=i %></td>
<td ><html:text indexed="true" name="lines" property="POD"/></td>
<td ><html:text indexed="true" name="lines" property="PON"/></td>
<td><html:text indexed="true" name="lines" property="POQ" size="6"/></td>
<td></td>
<td><html:text indexed="true" name="lines" property="UOM1" size="4" value="nos."/></td>
</tr>
<% i++; %>
</logic:iterate>


my function:
function changeValue(value)
{
var weight = value;
alert(weight);
alert(document.purchaseOrderBeanForm.lines[0].UOM1.value);

}

I am not getting the 2nd alert


Thanks.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So this is a JavaScript, not Struts, question?

JavaScript debugging is usually pretty easy using Firebug.
 
Deeps Mistry
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

David Newton wrote:So this is a JavaScript, not Struts, question?

JavaScript debugging is usually pretty easy using Firebug.



Hi,
You can say a mix of both. Since it involves dyna action form i thought to put it in struts.

Firebug? whats this? I am using eclipse.

Can you help me out please

Thanks
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
LMGTFY
 
Don't mess with me you fool! I'm cooking with gas! Here, read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic