/    Sign up×
Community /Pin to ProfileBookmark

Add more actions to a submit button

Hi

I have a form with several submit buttons. In one of them, I want to submit the form and disable it. How can I do that?

I tried

[CODE]onclick=”document.form.submit_button.disabled=true”

onmouseup=”document.form.submit_button.disabled=true”[/CODE]

but the form is never submited.

Can anybody help me on this?

Thanks in advance

Rui Gonçalves

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@holyhttpJan 11.2007 — The form is not submitted because the onclick event takes precedence and therefore disables the submit button before the form is submitted.

In any case, even if the form is submitted (to the web server I suppose) the current web page is not longer in control since a new page is about to be opened.

What you can do however is on the server-side check the name and value of the submit button then on the returning page disable the submit button.
×

Success!

Help @pranxas 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 5.10,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...