Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

document.forms[0].submit(); throws Invalid Argument in IE

 
Anirban Chowdhury
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a peculiar problem. I am developing a Struts 2.2 website. Now in one of the jsps, I use a function which inturn submits to another action.
Now, the problem is if, I call this function when it is present in .js file, it throws me an error "Invalid Argument".
However, if I copy-paste the same method in the jsp, then it works fine.


This is the method. The 0 is also alerted out, when I put the function definitiion in both the js file as well the jsp. However, the page doesn't get submitted from the .js file.
Am I missing something here?

Thanks a lot in advance!
Anirban

 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a form element named submit? If you do, rename it.

Eric
 
Anirban Chowdhury
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,
Thanks for your reply. I did have and I changed both the id and the name of the element. I checked the source as well after the page was rendered.Nothing with "submit". but sill the problem persists. This has a very easy workaround, but I hate duplicate code all over the jsps..

Thanks & Warm Regards
Anirban.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what does your form look like?

Eric
 
Anirban Chowdhury
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the button :


Also pasted below the source code, if you need it.


Thanks once again.

Anirban
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Form works fine for me, looks like you lost some of the code in it from not checking the "Disable HTML in this message" checkbox.

Eric
 
Anirban Chowdhury
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Eric,
Sorry my mistake!! I forgot to mention that it doesn't work if I put the function confirmDeleteEntity() into a js file. In this case, it works as the function is incuded. And no, the form has been completely rendered here. Thanks once again for your review Eric. I so , so want to get to the end of this..

Anirban.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic