• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

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

 
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

 
author
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
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
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.
 
You will always be treated with dignity. Now, strip naked, get on the probulator and hold this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!