/    Sign up×
Community /Pin to ProfileBookmark

submitting the form two times.

Hello,

I have a form in which there are two buttons,
input type of button1 is Submit and button2 is button.

<form name=”myForm” method=”post” action=”two.jsp”>
<input type=”submit” name=”btn1″ value=”Test1″>
<input type=”button” name=”btn2″ value=”Test2″>
</form>

I am calling a javascript on click of button2.

<script type=”text/javascript”>
function jump(){
myForm.action =”one.jsp”;
myForm.target = “_blank”;
myForm.submit();
}
</script>

After closing the popup window which is opened against button2, if I click button1 then it will open the same popup window.

Please help in fixing this issue.
Thank you

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@nathanpcMay 23.2010 — Please remember to put the html tags on HTML code, and the code tag on the JavaScript one, like this:
[code=html]<form name="myForm" method="post" action="two.jsp">
<input type="submit" name="btn1" value="Test1">
<input type="button" name="btn2" value="Test2">
</form>[/code]

And
function jump() {
myForm.action ="one.jsp";
myForm.target = "_blank";
myForm.submit();
}
Copy linkTweet thisAlerts:
@Sterling_IsfineMay 23.2010 — This may do it:[CODE]function jump(){
myForm.action ="one.jsp";
myForm.target = "_blank";
myForm.submit();
[B]myForm.target = '_self';[/B]
}[/CODE]
If the default action is different, you may need to reset that too.
Copy linkTweet thisAlerts:
@shareefauthorMay 25.2010 — Hi,

Still having the same problem.

In one. jsp file I have a code to convert the data to excel sheet.

When one.jsp is called, a popup window appears and a file download window to 'Open'/'Save'/'Cancel' options.

Now I am not getting the popupwindow but only the file download window.
×

Success!

Help @shareef spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...