document.forms['formBeanName'].elements['userId'].value = 'xyz'; if you invoke the Javascript from a form element, you can pass this reference and simply do:
formReference.elements['userId'].value = 'xyz'; -----Original Message----- From: Slattery, Tim - BLS [mailto:[EMAIL PROTECTED] Sent: 30 March 2005 16:50 To: 'Struts Users Mailing List' Subject: RE: [HELP] How can javascript reference to 1 html:hidden tag or html:text ??? > I don't know how javascript reference to 1 html:hidden tag or > html:text tag of struts tag lib and change their value. > for example: > I have <html:hidden property="userId"> document.getElementsByName("userId")[0].value="whatever"; If you use the "styleId" attribute, which yields an "id" attribute in HTML: <html:hidden property="userId" styleId="somename"/> You can do this: document.getElementById("somename").value="whatever"; Note that the "styleId" attribute was mistakenly left out of the html:hidden tag in Struts 1.1. -- Tim Slattery [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]