Submit Button

G

Guest

How do I disable a submit button within a form until the user has ticked a
checkbox to indicate they have accepted terms.
 
J

Jon Spivey

Hi Andy,

Something along these lines
<form onsubmit="if(!chk.checked){alert('You must check the box'); return
false;}">
.....form fields......
Check this box before you submit <input type="checkbox" name="chk">
<input type="submit">
</form>

Cheers,
Jon
 
G

Guest

Hi Jon

Thanks for your prompt reply, the trouble is there is already a on submit tag

onsubmit="location.href='_derived/nortbots.htm';return false;"

what will happen if this is removed

Andy
 
J

Jon Spivey

You should be able to add the 2 together,

<form onsubmit="if(!chk.checked){alert('You must check the box'); return
false;}else{location.href='_derived/nortbots.htm';return false;}">

Cheers,
Jon
 
D

David Berry

You can add more that one JavaScript to the onsubmit separated by a
semi-colon. Also, the nortbots reference indicates that there may be a
problem with the FrontPage Extensions on the web server or if you set up the
form on a disk-based web. The reference shouldn't be in your form.

Switch to Code View and see if your line looks similar to this:

<form method="POST" name="myform"
onSubmit="location.href='_derived/nortbots.htm';return false;"
action="--WEBBOT-SELF--">

If it does, remove the entire line of code that begins with the "onSubmit"
statement. Your code will now look similar to the following: <form
method="POST" name="myform"
action="--WEBBOT-SELF--">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top