Results 1 to 8 of 8

Thread: OnSubmit "I Agree" open a registration form

  1. #1
    Join Date
    Jan 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default OnSubmit "I Agree" open a registration form

    I am looking for or need help with a JavaScript that will do the following:

    When an applicant checks the "I agree" check box for a membership agreement, the script validates that the box was checked and then automatically opens in the same windown a membership application form that the applicant completes and submits.

    I need this asap.

    Thanks,

    gerhardtj

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It's better to have the "I Agree" checkbox as part of the form, validated by the same server-side script that validates the application.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Aug 2004
    Posts
    9,894
    Thanks
    3
    Thanked 967 Times in 955 Posts
    Blog Entries
    15

    Default

    Check out Agree Terms script, though as Twey said, only a server side script can ensure the user has checked the box, as if JavaScript is disabled, the script I mentioned would be bypassed.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Bypassing aside, there's simply no point doing client-side checking of data when you're going to do server-side validation anyway.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Jan 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Quote Originally Posted by Twey View Post
    Bypassing aside, there's simply no point doing client-side checking of data when you're going to do server-side validation anyway.
    Thanks for your feedback. I agree that server-side validation is the way to go. I am using a php email form to collect applicant data. I imagine the server side "I agree script" that would open a second application form when checked (validation) could be done in php?

    Any suggestions? Scripts? I am working on a php 5.0/MySql Linux OS Apache web server.

    Thanks, again.

    Gerhardt

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Why? Just stick a checkbox at the bottom of your form:
    Code:
    <label>
      <input type="checkbox" value="yes" name="tos">
      I agree with the <a href="tos.html">terms and conditions</a>.
    </label>
    ... and modify the PHP script a little.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    continuation...
    PHP Code:
    if (isset($_POST["tos"])) {
        
    //enter exisisting code here
        

    and set the form method to "post" and action to the file above.
    - Mike

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You might want an else clause there to display an error message, too.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •