aspose file tools
The moose likes Struts and the fly likes help me with this problem.. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply 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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: help me with this problem..
 
Similar Threads
Enabling / disabling forms (Struts)
JSP Action Buttons freez after returning from ajax call
Javascript and Struts Indexed Text Boxes
Struts HTML Lib w/Ajax - Can't get textbox value to Action class
Retrieving value from radio buttons using struts tag(Please let me know if my quest is not clear)