Reputation: 77
I have a simple form that looks like this:
<form action = '../../uploadGI/index.php' method = 'post' target = '_blank'>
... (inputs)
<button class='btn actionbtn closebtn' onClick = 'this.form.submit()' ... >Submit</button>
</form>
The forms sends a number of parameters to a new page where the user can upload a document (or scan it), the parameters are related to the type of doc, the table and table record it refers to in the db.
When I leave target = "_blank" out the form works as intended. But with target _blank the button opens the page ... twice. What is causing this behaviour?
Upvotes: 0
Views: 60
Reputation: 13079
The default action for a button input in a form is to submit the form. No need for the onClick
attribute/handler. Just remove the onClick
<button class='btn actionbtn closebtn' ... >Submit</button>
Upvotes: 2