This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Struts and the fly likes Javascript Manipulation of Struts SELECT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Javascript Manipulation of Struts SELECT" Watch "Javascript Manipulation of Struts SELECT" New topic

Javascript Manipulation of Struts SELECT

Siva Arun

Joined: Feb 23, 2010
Posts: 28
I am having a dynamic table structure below.

productList is having Product objects. I need to take the price value (productUnitPrice) out of Product object and assign to the 'txtUnitPrice' text box based on the selected product. I have stuck with the below code. Can you help me to proceed further?

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan.
David Newton

Joined: Sep 29, 2008
Posts: 12617

Why not just access the select box directly (use its "styleId" attribute) and grab its value and set it to the text box?

I'd *strongly* recommend using a JavaScript library like jQuery, Prototype, etc.

I'm also moving this to HTML and JavaScript as this seems to be more a JavaScript/DOM issue than Struts, at least once you use the styleId attribute.
Have you checked out Aspose?
subject: Javascript Manipulation of Struts SELECT
jQuery in Action, 3rd edition