SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2009
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Tick box confirm before continue

    Hey everyone, I'm hoping I can get some help. I found this code online which appears to do what I am after, but I am unsure how to customise it.

    What I want is for a check box to appear which will have terms and conditions, i.e. "by purchasing this item you understand you will be billed $19.95 and be re-billed in 30days for $199 automatically".

    Once the box is ticked they can then select the 'order now' button which will go to a Clickbank payment page (products on Clickbank). If they click the order button and didn't tick the box then a pop-up will appear saying "please agree to the conditions".

    This is my code but I'm unsure how to do the following:

    - Get the form to do something when I click the button
    - have a custom order button (image).
    - create a new line for the order button to appear (so it's not flush against the conditions content)

    Thanks in advance.


    Code:
    <html>
    <head>
    </head>
    <body> 
    
    <form action="post" action="http://www.clickbank-order-form-page.html" onsubmit="return false;"> 
    <input type ="checkbox" name="agree" value="anything"> 
    <b>terms and conditions</b> 
    <input type="submit" name="submitButton" onClick="check_agree(this.form);" value="Go" src="order.jpg"> 
    </form>
    <script language="Javascript"> 
    function check_agree (form) { 
    if (form.agree.checked) { 
    form.submitButton.disabled = true; 
    form.submit(); 
    } 
    else { alert('You must agree to terms and conditions'); } 
    }
    
    </body>
    </html>

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by reekdog View Post
    Hey everyone, I'm hoping I can get some help. I found this code online which appears to do what I am after, but I am unsure how to customise it.

    What I want is for a check box to appear which will have terms and conditions, i.e. "by purchasing this item you understand you will be billed $19.95 and be re-billed in 30days for $199 automatically".
    It is a bad business practice to rely on JavaScript for handling order payments.

    Use server-side code (such as PHP or .NET) to check that the form is filled out correctly, and provide the appropriate warnings and messages when things are incomplete.
    Only after that part of things is first working, should you use client-side scripting to reduce invalid submissions to the server and provide an improved user experience for the user.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2009
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This isn't for the payment page, this is just to go to the payment page.

    I don't know how to code, which is why I found the code in my previous post when doing a Google search.

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by reekdog View Post
    I don't know how to code, which is why I found the code in my previous post when doing a Google search.
    You require that the person agrees to the conditions before going to the payment page.

    There are many reasons and situations that can prevent JavaScript from running on a persons web browser, from personal preference, to a handicap, to business firewalls, and all points inbetween.

    JavaScript is not a scripting language that you can rely to be available from the users web browser.
    This is why you should always make sure that the task is capable of being achieved without JavaScript first, before using JavaScript to improve on the user experience.

    You said before that you don't know how to code. It would be wise for you to allow people who do know how to code advise you on how to best avoid traps and pitfalls that end up causing you large amounts of pain.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •