wood burning stoves 2.0*
The moose likes Struts and the fly likes help me with this problem.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "help me with this problem.." Watch "help me with this problem.." New topic
Author

help me with this problem..

shah rah
Ranch Hand

Joined: Jan 04, 2007
Posts: 124



onclick of button I want the textbox value associated with that button.
if button[0] is clicked I want the hid_text[0].value
if button[1] is clicked I want the hid_text[1].value

how to get the corresponding value?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Whenever you have a form element with a name that includes JavaScript-sensitive characters such as periods and square brackets, you can't use the usual JavaScript notation of "document.myForm.myInput". However, with JavaScript there's always more than one way to do things, so you just have to get a little creative about how to access the object. One way would be to use the getElementsByName method. This method always returns an array, even if there's only one element with that name. Therefore, something like the following would work:

[ March 23, 2007: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help me with this problem..