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()%>/getAccounts.do";
  formObject.forms[0].submit();

or if the form were named 'myForm' you could use ...

  formObject.myForm.action="<%=request.getContextPath()%>/getAccounts.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:[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]>

Reply via email to