/    Sign up×
Community /Pin to ProfileBookmark

Tick box energising ‘submit’ button

Hi, is it possible to incluse a tick box on a html form which then ‘energises’ the ‘Submit’ button?

E.g. I have a form which i want people to read and agree (via a tick-box) to a disclaimer before the submit button on the form is energised.

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@RoddersNov 26.2002 — Something like.....

<FORM NAME=myform>

Agree? <INPUT TYPE=CHECKBOX onClick="document.myform.submit();">

</FORM>
Copy linkTweet thisAlerts:
@HutchballauthorNov 26.2002 — That works, thanks, but its just a tick box which submits. Is it possible to have a 'locked' submit button which unlocks when the box is ticked?
Copy linkTweet thisAlerts:
@RoddersNov 26.2002 — <FORM NAME=myform>

Agree? <INPUT TYPE=CHECKBOX onClick="document.myform.btnSubmit.disabled = false;">

<INPUT TYPE=SUBMIT NAME=btnSubmit DISABLED>

</FORM>


EDIT: You might want to add further code to disable the button again if the user unticks the box.
Copy linkTweet thisAlerts:
@HutchballauthorNov 26.2002 — Thanks Rodders. Thats working great. You couldn't help us with the code to re-disable it again? Please?
Copy linkTweet thisAlerts:
@HutchballauthorNov 27.2002 — Can anybody help?
Copy linkTweet thisAlerts:
@RoddersNov 27.2002 — <SCRIPT TYPE='text/javascript'>

function switchbutton() {

if (document.myform.btnSubmit.disabled) {

document.myform.btnSubmit.disabled = false;}

else {

document.myform.btnSubmit.disabled = true;}

return true;

}

</SCRIPT>


<FORM NAME=myform>

Agree? <INPUT TYPE=CHECKBOX onClick="return switchbutton();">

<INPUT TYPE=SUBMIT NAME=btnSubmit DISABLED>

</FORM>
Copy linkTweet thisAlerts:
@HutchballauthorNov 28.2002 — That works a treat, thanks mate. ?
×

Success!

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