File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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.
I agree. Here's the link:
subject: Javascript Manipulation of Struts SELECT
It's not a secret anymore!