============================== Sorry, minor correction in example needed: The java script should be
dosomething() { alert(document.somethingFormConfigOptionA.command.value); alert(document.somethingFormConfigOptionB.command.value); } =============================== -----Original Message----- From: Linck, Ken [mailto:[EMAIL PROTECTED] Sent: Friday, June 04, 2004 11:36 AM To: '[EMAIL PROTECTED]' Subject: Alias names that can be used in javascript to reference <html:for m> when using multiple forms that could point to the same action? I am in the process of removing all our Struts 1.0 deprecated code in anticipation of moving to Struts 1.2(when its release). I was looking at the <html:form...> tag and how they removed the "name", "type", "scope" attributes of the <html:form> tag stating that the action mapping will determine these values. My question is, does anything exist or will exist to refer to a form in javascript without having to dive into a positional array when having multiple html:form's tags pointing to the same action?(which maybe a bad approach to begin with but at this point I am trying to avoid significant changes to these jsps if possible). Each <html:form..> had a "name"(I consider it like an alias pre Struts 1.2) which was being referenced in javascript. When I removed the "name" attribute, I think the javascript broke because it could not resolve "somethingFormConfig1.command.value" since the alias no longer exists. Code tidbit below: ================================================================== Example that worked pre-Struts 1.2 and now broken: dosomething() { alert(document.somethingFormConfig1.command.value); alert(document.somethingFormConfig2.command.value); } <html:form action="Something.do" name="somethingFormConfigOptionA"> <html:hidden name="command" value="configA"/> <html:hidden name="paramX" value="123"/> </html:form> <html:form action="Something.do" name="somethingFormConfigOptionB"> <html:hidden name="command" value="configB"/> <html:hidden name="paramX" value="456"/> </html:form> =================================================================== Struts 1.2 change I put in to make it work but does not seem as elegant(being now positional): dosomething() { alert(document.SomethingFormConfig[0].command.value); alert(document.SomethingFormConfig[1].command.value); } <html:form action="Something.do"> <html:hidden name="command" value="configA"/> <html:hidden name="paramX" value="123"/> </html:form> <html:form action="Something.do"> <html:hidden name="command" value="configB"/> <html:hidden name="paramX" value="456"/> </html:form> ==================================================================== NOTE: Assume that the name is "SomethingFormConfig" in the struts-config. The only other solution I could think of is to define multiple actions pointing to the same action and form class(if thats possible) but I did not try that and that seemed like overkill to me to solve a javascript error at this point unless no other elegant solution was available. Thanks for advice in adance. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]