PDA

View Full Version : "Accept terms" form submission



emanuelle
02-19-2009, 10:32 AM
http://www.dynamicdrive.com/dynamicindex16/acceptterm.htm

I love this script but I want to use a submit button that i have designed. I have the normal one and the disabled version

can anyone help????

Snookerman
02-19-2009, 10:46 AM
You can just give the button a class or id value and then style it however you want.

Good luck!

emanuelle
02-19-2009, 11:06 AM
like this?
<input name="" type="image" value="Submit!" src="images/buttons/b_continuel_disable.gif" />

but then how will it go to the active button once I click on the checkbox?

Snookerman
02-19-2009, 11:15 AM
Try:

<input class="button" type="Submit" value="Submit!" disabled>

.button {
background: url('images/buttons/b_continuel_disable.gif');
}

Good luck!

emanuelle
02-19-2009, 11:27 AM
ok but how do i call to show another class when button is in enable mode?

Nile
02-22-2009, 01:31 AM
Like this:


.button {
background: url('url');
}
.button[disabled="true"] {
background: url('images/buttons/b_continuel_disable.gif');
}

emanuelle
02-22-2009, 08:02 AM
txs a lot but still it doesnt work
I am sending you the whpole code. what is wrong????

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
.buttons {color:#fff;border:1px solid #fff;background-color:#b46f02;}/*enable button must be in orange with white text*/
.buttons[disabled="true"] {color:#fff;background-color:#dcd5c0;}/*disable button must be in gray with white text*/
</style>

<script>

//"Accept terms" form submission- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var checkobj

function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){ //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}

function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please read/accept terms to submit form")
return false
}
}
}

</script>
</head>

<body>
<form name="agreeform" onSubmit="return defaultagree(this)">
Rest of your form here<br>
<input name="agreecheck" type="checkbox" onClick="agreesubmit(this)"><b>I agree to the above terms</b><br>
<input class="buttons" type="Submit" value="Submit!" disabled>
</form>

<script>
//change two names below to your form's names
document.forms.agreeform.agreecheck.checked=false
</script>

</body>
</html>

Nile
02-22-2009, 02:28 PM
Sorry, do this:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
.buttons {color:#fff;border:1px solid #fff;background-color:#b46f02;}/*enable button must be in orange with white text*/
.buttons[disabled="true"], .buttons[disabled] {color:#fff;background-color:#dcd5c0;}/*disable button must be in gray with white text*/
</style>

<script>

//"Accept terms" form submission- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use

var checkobj

function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){ //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}

function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please read/accept terms to submit form")
return false
}
}
}

</script>
</head>

<body>
<form name="agreeform" onSubmit="return defaultagree(this)">
Rest of your form here<br>
<input name="agreecheck" type="checkbox" onClick="agreesubmit(this)"><b>I agree to the above terms</b><br>
<input class="buttons" type="Submit" value="Submit!" disabled>
</form>

<script>
//change two names below to your form's names
document.forms.agreeform.agreecheck.checked=false
</script>

</body>
</html>