Hi All -

Can you please look at this code for me?

I need to be able to have this script LOAD A URL when the checkbox is checked and the SUBMIT is pressed....

Thanks so much!!!

<head>
<script>

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
}
}
}
</head>

<body>
<form name="agreeform" onSubmit="return defaultagree(this)">
Here is form or text<br>
<input name="agreecheck" type="checkbox" onClick="agreesubmit(this)"><b>I agree to the above terms</b><br>
<input type="Submit" value="Submit!" disabled>
</form>

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

Hi there,

Check this code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
<!--
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
}
}
}

function goToURL() { 
  var i, args=goToURL.arguments; document.returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>
<body>
<form method="get" name="agreeform" onsubmit="goToURL('parent','URL');return document.returnValue" >
  Here is form or text<br>
  <input name="agreecheck" type="checkbox" onClick="agreesubmit(this)">
  <b>I agree to the above terms</b><br>
  <input type="Submit" value="Submit!" disabled onClick="return defaultagree(this)">
</form>
<script>
//change two names below to your form's names
document.forms.agreeform.agreecheck.checked=false
</script>
</body>
</html>

Rahul
Http://www.katarey.com

Hi there,

Check this code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
<!--
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
}
}
}

function goToURL() { 
  var i, args=goToURL.arguments; document.returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>
<body>
<form method="get" name="agreeform" onsubmit="goToURL('parent','URL');return document.returnValue" >
  Here is form or text<br>
  <input name="agreecheck" type="checkbox" onClick="agreesubmit(this)">
  <b>I agree to the above terms</b><br>
  <input type="Submit" value="Submit!" disabled onClick="return defaultagree(this)">
</form>
<script>
//change two names below to your form's names
document.forms.agreeform.agreecheck.checked=false
</script>
</body>
</html>

Rahul
Http://www.katarey.com

THANK YOU! For that.... Where can I place the URL address that I want it to goto after Submit though? That is, if I dont wnt it to be parent or current page.....

THANK YOU! For that.... Where can I place the URL address that I want it to goto after Submit though? That is, if I dont wnt it to be parent or current page.....

Hi there,

well you just need to put the URL and target window here

<form method="get" name="agreeform" onsubmit="goToURL('[B]parent[/B]','[B]URL[/B]');return document.returnValue" >
  Here is form or text<br>
  <input name="agreecheck" type="checkbox" onClick="agreesubmit(this)">
  <b>I agree to the above terms</b><br>
  <input type="Submit" value="Submit!" disabled onClick="return defaultagree(this)">
</form>

Best Regards,
Rahul
http://www.katarey.com

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.