wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes img tag empty src attribute causes duplicate form submission Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "img tag empty src attribute causes duplicate form submission" Watch "img tag empty src attribute causes duplicate form submission" New topic
Author

img tag empty src attribute causes duplicate form submission

Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
What is the exact email, why would you have an empty img tag?

Eric
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
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

Joined: Feb 26, 2005
Posts: 2049
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).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: img tag empty src attribute causes duplicate form submission
 
Similar Threads
Issue with weblogic 10 on struts form bean
Buttons EventHandler and Property-Setting
Struts 2: Forms with multiple submit buttons - Best Practice?
LookupDispatchAction
how to include image in JEditorPane ?