By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,806 Members | 1,335 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,806 IT Pros & Developers. It's quick & easy.

IE issue with setting action

P: 22
Hello Friends,

I have the following code in my JS file:


Expand|Select|Wrap|Line Numbers
  1.     document.getElementById('form1').action = theContextRoot+myURL;
  2.  
  3.     childWin = window.open("", "myWindow", 'toolbar=0,location=0,directories=0,status=1,scrollbars=1,resizable=1,width=450,height=200');
  4.  
  5.     document.getElementById('form1').target = "childWin";
  6.     document.getElementById('form1').submit();

It is working properly in Mozilla. But in IE I am getting a Javascript error at line 1 while setting action. It says 'Object doesn't support this property or method'

Why is it so? Any clues/direction? any hints for debugging?

Thanks a lot in advance!

Regards,
Leena
Feb 14 '07 #1
Share this Question
Share on Google+
8 Replies

acoder
Expert Mod 15k+
P: 16,027
The action attribute is supported by IE. See this page (action second property).

Perhaps you could post your form code.
Feb 14 '07 #2

P: 22
Yes I know that IE supports this. I had seen the W3C site page you referred to.

While I am removing some sensitive information from the html page code to post it here, why do you think the form code will make a difference?
Any pointers I can myself check and test? Like use of some tags or nesting related issues etc you are aware of that will cause such a problem?

Regards,
Leena
Feb 14 '07 #3

acoder
Expert Mod 15k+
P: 16,027
It is difficult to pinpoint an error without seeing the full code.

One possibility is that the id might not be "form1", but then it shouldn't work in Firefox either.

How have you set theContextRoot?
Feb 14 '07 #4

P: 22
In the JSP page from which this JS function is called I have declared it as follows:
Expand|Select|Wrap|Line Numbers
  1. <script language=JavaScript>
  2. var theContextRoot = "<%=request.getContextPath()%>";
  3. </script>
The JS function is in a JS file which is included in the JSP page.

When I print its values, Im getting it right in the JS function.
Feb 15 '07 #5

acoder
Expert Mod 15k+
P: 16,027
Ok, I've searched on this, and I discovered this thread. Maybe you have set a form hidden value as "action"?
Feb 15 '07 #6

P: 22
Yes I do have.. I commented the hidden field and tried it again.
It worked. I did not get the error.

Why is this so? Im not using it like document.form1.action like in the example.

Im using it like -
document.getElementById('form1').action

Actually I cannot do without this hidden field on the form.

Regards,
Leena
Feb 17 '07 #7

10K+
P: 13,262
Yes I do have.. I commented the hidden field and tried it again.
It worked. I did not get the error.

Why is this so? Im not using it like document.form1.action like in the example.

Im using it like -
document.getElementById('form1').action

Actually I cannot do without this hidden field on the form.

Regards,
Leena
You might have to change its name then. It was not a good choice for a variable name too.
Feb 17 '07 #8

acoder
Expert Mod 15k+
P: 16,027
Yes I do have.. I commented the hidden field and tried it again.
It worked. I did not get the error.

Why is this so? Im not using it like document.form1.action like in the example.

Im using it like -
document.getElementById('form1').action

Actually I cannot do without this hidden field on the form.

Regards,
Leena
IE is easily confused! Just because you named a form item name "action", it gives precedence to that for some reason and tries to set that to the action value (or some other nonsense)!

In any case, action is a bad name to choose for any variable on a page. As r0 mentioned, just change the name to something else and change your server-side script accordingly.
Feb 17 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.