Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

img tag empty src attribute causes duplicate form submission

 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On an html 'button' on my html page, I call an 'onclick' function. It does a xxx.action="/cccc", and forms[0].submit() after that.

It results in 2 submissions of the form, resulting in 2 (duplicate) calls to my server processing.

Googling had me informed that an empty src on an img (src="") causes it. I tried and filled the src with a dummy src, and it fixed my problem.

Any one knows the explanation of why the src="" affects my form submission?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the exact email, why would you have an empty img tag?

Eric
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below is the related parts. (struts 1 is involved)



Initially, I dont need to put an entry in the src because I 'hide' it using css.

The src value also is dynamic.

By the way, in the above code, I typed in src="", but it doesnt appear in the post.
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didnt notice the 'disable html'.

Ill make a small web app to isolate the issue, and post the generated html here (if the issue happens).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic