Back Home

Open Designs

Community. Driven.

    • CommentAuthorEileen
    • CommentTimeApr 15th 2008
     
    You all have been great in the past, now I dont know how to handle this. I need a user to accept terms via a check box and then use a button on that page to bring user to a new url. Would I be using a form? Is there another way to handle? I little direction or suggested reading would be great. I use dreamweaver.
    Thanks in advance,
    Eileen
    • CommentAuthorJames
    • CommentTimeApr 15th 2008
     
    I've had to do something similar in the past, I used a form with a checkbox. If the checkbox was ticked when the form was submitted it set a session variable which allowed the user to view the new URL.

    It depends on the server your site is hosted on - I use IIS so I'm dealing with ASP code.

    The easier option would be to set a session cookie once the form has been submitted (assuming the box was checked) which would grant or deny access to the requested page.

    If for example a user was agreeing to terms to create an account then either option would work.

    On the other hand if you were asking a user to agree to terms to download a template it might get frustrating if you had to check the box for every page visit and they might move on.
    • CommentAuthorEileen
    • CommentTimeApr 15th 2008
     
    session variables? server parameters? yikes, more complex then I thought. OK, maybe this makes a difference- the 'accept terms' is a 1 time deal, and I don't really care to save it because I will know they did it if they got to the register page at any time in the past. I need the box checked in order to move them off the page.
    Cant I just isolate this action to this one page without making it into a complex process?
    In order for my page to do what I want 2 things will happen:
    user will check box, if not I will let them know they need to in order to move on.
    user will click button to go to new url.
    I definately dont want to frustrate users.
    make sense?

    E
    • CommentAuthorEileen
    • CommentTimeApr 15th 2008
     
    I got it- I'm using PHP,
    so the PHP is going to handle what happens when the 'submit' or Go button is selected.
    OK, the pieces are coming together- your ASP to my PHP
    I think Im good now- in this respect.
    • CommentAuthorJames
    • CommentTimeApr 15th 2008 edited by James on the 15th April 2008 at 12:57:28 EDT
     
    If you're looking for a simple solution just to move a user off a page then Javascript might be useful to you, I found this code ages ago which works like a charm.

    There are 2 steps to use this code:

    1. Copy the coding into the HEAD of your HTML document
    2. Add the last code into the BODY of your HTML document

    Step 1: Paste this code into the HEAD of your HTML document

    <script language="JavaScript">

    <!--
    function ValidateCheckBox(f){
    if (f.agree-to-terms.checked == false )
    {
    alert('You must agree to the terms and conditions!');
    return false;
    }else
    return true;
    }
    //-->

    </script>


    Step 2: Copy this code into the BODY of your HTML document

    <form action="/your-page.html" method="POST" onsubmit="return ValidateCheckBox(this)">
    I accept: <input type="checkbox" value="0" name="agree-to-terms">
    <input type="submit" value="I agree">
    <input type="button" value="I do NOT agree" onclick="document.location.href='/index.html';">
    </form>


    If the user does NOT check the box prior to submiting the form the form is not processed and they get a pop-up message telling them they must accept the terms.

    One last note, lots of sites use different methods of checking that the terms are agreed to but some don't provide a link to their terms which can be frustrating...

    Hope this helps!