/    Sign up×
Community /Pin to ProfileBookmark

deactivate submit button

hi, im wondering, how can u deactivate a sumbit button?or any form button?

to post a comment
Full-stack Developer

5 Comments(s)

Copy linkTweet thisAlerts:
@CharlesJan 01.2005 — [font=monospace]<form action="some-script.pl" onsubmit="return check (this); return false">[/font]

If the function check() returns false the form does not submit.
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYauthorJan 01.2005 — does the button then appear grey in IE?
Copy linkTweet thisAlerts:
@PeOfEoJan 01.2005 — You can also use disabled="true" for a button.
Copy linkTweet thisAlerts:
@CharlesJan 01.2005 — [i]Originally posted by PeOfEo [/i]

[B]You can also use disabled="true" for a button. [/B][/QUOTE]


That's how you set something to diabled with JavaScript. With HTML it is different and with XHTML it is different again. But often it is a bad to have your button disabled by default. People without JavaScript will not be able to use it.

If you do want the button to default to disabled then you could use HTML:

[font=monospace]<button disabled>Foo</button>[/font]

or in XHTML:

[font=monospace]<button disabled="disabled">Foo</button>[/font]

See http://www.w3.org/TR/html401/interact/forms.html#edef-BUTTON .
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYauthorJan 01.2005 — thank u just what i needed..its just to block a form until i finished writing the processing file...

thx
×

Success!

Help @LiLcRaZyFuZzY 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,
)...