Results 1 to 4 of 4

Thread: Accept Terms script button links to URL

  1. #1
    Join Date
    Feb 2008
    Location
    california
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Accept Terms script button links to URL

    "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>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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):

    Code:
    <form action="enroll.html" name="agreeform" onSubmit="return defaultagree(this)">
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Feb 2008
    Location
    california
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    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):

    Code:
    <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/signupun...&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???

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •