Win a copy of Spark in Action this week in the Open Source Projects forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

retrieve value of a field

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
LMGTFY
 
It was the best of times. It was the worst of times. It was a tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic