PDA

View Full Version : Accept Terms script button links to URL



jonnyhay
03-11-2009, 05:45 AM
"Accept terms" form submission

http://dynamicdrive.com/dynamicindex16/acceptterm.htm

I have researched the "accept terms" script, but I have not found a way so when you click on the submit button, it can link to a new page or URL. I ultimately want so the client can click I agree and then sign up via paypal for a monthly subscription. Not sure if that is possible.

I will be satisfied if I can just take them to a page where I have the paypal "buy now" button.
The user clicks submit, and it simply goes to a URL of another page on your site, "enroll.html" for example.

Any help would be greatly apprectiated!

Here the code for the <HEAD>:
<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
}
}


and for the Form:

<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 type="Submit" value="Submit!" disabled>
</form>

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

<p align="center"><font face="Arial" size="-2">Free DHTML scripts provided by<br>
<a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p>


}

</script>

jscheuer1
03-11-2009, 07:36 AM
It helps if you understand how forms work. If you have an action attribute, that is where the form will take you. So for example you could just (addition highlighted):


<form action="enroll.html" name="agreeform" onSubmit="return defaultagree(this)">

jonnyhay
03-11-2009, 05:03 PM
It helps if you understand how forms work. If you have an action attribute, that is where the form will take you. So for example you could just (addition highlighted):


<form action="enroll.html" name="agreeform" onSubmit="return defaultagree(this)">
I have it live here:

http://nourishsantacruz.com/signupunlimitedyoga.html

I had tried putting the action="enroll.html" previously, it didn't work so I removed it from the question. But I tried again, with the action, and it doesn't work. I tried with the whole http:// url, but no luck. It puts this in the url box:

http://nourishsantacruz.com/signupunlimitedyoga.html?S1=DYNAMIC+DRIVE+SCRIPTS+USAGE+TERMS%0D%0AAgreement+Goes+here&agreecheck=on

to me it seems it isn't running the action, and only the javascript that checks to see if the button can turn on or not???

jscheuer1
03-11-2009, 10:13 PM
I think you are viewing an older cached copy of your own page. If I agree and submit it goes to:

signupuy.html

which is currently the action of the form.

If you are still having a problem, clear your browser's cache before viewing the page again, and refresh the page before accepting and submitting.