Do you have a field that is also named "action"? If so, then document.forms[0].action will refer to the object for that field and not to the form.action property.
-----Original Message----- From: Suresh Addagalla [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 09, 2003 12:48 To: 'Struts Users Mailing List' Subject: RE: Call Struts Action from JS Hi, IE 5.0 seems to be treating document.forms[0].action as an "Object", where as, earlier I used it directly set an URL string many times. Any ideas? Suresh >-----Original Message----- >From: Siggelkow, Bill [mailto:[EMAIL PROTECTED]] >Sent: Wednesday, January 08, 2003 9:54 PM >To: 'Struts Users Mailing List' >Subject: RE: Call Struts Action from JS > > >Also, I meant to say that the error from IE is saying that in >its DOM it doesn't have the property you are referring to. If >the formObject is actually the form itself then eliminate the >'form' property ... in other words, you would have: > > formObject.action="<%=request.getContextPath()%>/getAccounts.do"; > formObject.submit(); > >-----Original Message----- >From: Siggelkow, Bill [mailto:[EMAIL PROTECTED]] >Sent: Wednesday, January 08, 2003 11:20 AM >To: 'Struts Users Mailing List' >Subject: RE: Call Struts Action from JS > > >What type of object is formObject? That is, how are you >calling this function (e.g. from onclick? or some other event handler). > >If 'formObject' is actually the 'document' then you would do >something like ... > > >formObject.forms[0].action="<%=request.getContextPath()%>/getAc >counts.do"; > formObject.forms[0].submit(); > >or if the form were named 'myForm' you could use ... > > >formObject.myForm.action="<%=request.getContextPath()%>/getAcco >unts.do"; > formObject.myForm.submit(); > >Also, I am curious as to why you are needing to set the action >via JavaScript when it doesn't seem like it is dynamic? Even >if you submit using the submit() method of Form it will still >use the action that is specified for the form tag. > >Another thing to keep in mind is that calling 'submit()' will >not invoke any onsubmit event handlers if you have them. In >general, I don't like using the 'submit()' method but >sometimes it is unavoidable. > >-----Original Message----- >From: Gus Delgado [mailto:[EMAIL PROTECTED]] >Sent: Wednesday, January 08, 2003 10:51 AM >To: Struts Users Mailing List >Subject: Call Struts Action from JS > > >when I call an action from JavaScript like this, it works fine under >Mozilla (Netscape) but I get a warning under IE, any ideas how to get >around that popup. > >Error: "Object does not support this property of method" on the line >that I call the struts action. > >If I select no on the popup it will give me the response but I >want the >popup not to show, any ideas? Thanks. > ><script language="JavaScript"> >function setNav(formObject) > { > //alert ("FormObject: " + formObject ); > >formObject.form.action="<%=request.getContextPath()%>/getAccounts.do"; > formObject.form.submit(); > } ></script> > > > >-- >To unsubscribe, e-mail: ><mailto:struts-user->[EMAIL PROTECTED]> >For >additional commands, >e-mail: <mailto:[EMAIL PROTECTED]> > >-- >To unsubscribe, e-mail: ><mailto:struts-user->[EMAIL PROTECTED]> >For >additional commands, >e-mail: <mailto:[EMAIL PROTECTED]> > >-- >To unsubscribe, e-mail: ><mailto:struts-user->[EMAIL PROTECTED]> >For >additional commands, >e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>