Click to See Complete Forum and Search --> : Button.


DanUK
10-25-2003, 02:00 PM
Hi there. Sorry to post again! hehehe.

At the moment, i have a section of my site which has an application form - the front of this "section" is a terms page, which at the moment I have just an "I Accept" and "I decline" <a href=".."> to take the user to the application.

Is there a way to have a checkbox to say that they've read the terms and a button to "Accept" which would send them to another page? I've seen on other sites the button is "faded" until the terms are accepted. Is it possible to achieve this?

Many thanks!

Charles
10-25-2003, 02:25 PM
It's easily done but you have to be careful. If you set the button as "disabled" with HTML then people without JavaScript will never be able to submit the form.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Example</title>

<style type="text/css">
<!--
fieldset {float:left; padding:1ex}
label {display:block; text-align:center}
input {margin-right:1ex}
button {clear:left}
-->
</style>

<script type="text/javascript">
<!--
onload = function () {document.getElementById('reallyAccept').disabled = true}
// -->
</script>

<form action="">
<div>
<fieldset>
<legend>Terms</legend>
<textarea>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipitlobortis nisl ut aliquip ex ea commodo consequat.</textarea>
<label><input type="checkbox" onclick="this.form.reallyAccept.disabled = !this.checked">I accept</label>
</fieldset>
<button type="submit" id="reallyAccept">Submit</button>
</div>
</form>

DanUK
10-25-2003, 02:32 PM
Thanks very much!
How about just a normal button for another page which takes them to another page?

I.e. clicking a button labelled "Go" takes them back to index.php?

Charles
10-25-2003, 02:35 PM
It's a form. Simply supply the desired URL as the value of the FORM element's "action" attribute.