Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2012
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    UI Modal needed...

    What I have is a simply contact form, and when the user hits 'Submit', it needs to pop up with a window asking if the user agrees to disclaimer before the form is sent.
    I know very little about JS, and I've tried searching around the web to find some type of UI Modal (I want to be able to customize the style of it to match the website's theme), but all I can find is a UI Modal that allows you to confirm something, but then just shows the results 'you confirmed it!', or along those lines.

    So basically, something like this:
    User fills out form, clicks Submit.
    Pop up: "Do you agree to the *blah blah blah*?
    I AGREE -or- CANCEL
    if I AGREE - finish submitting the form
    if CANCEL - close pop up window

    If you'd like to look at the contact form, click here and scroll down to it.
    Last edited by pthornt1; 11-02-2012 at 04:12 AM.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,730
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    Code:
    <form onsubmit = "return agreeterms()">
    
    Content of form
    <br><br>
    
    <input type = "submit" value = "Submit The Form">
    
    <script type = "text/javascript">
    
    function agreeterms() {
    var c = window.confirm ("Confirm that you have read and agree to the terms and conditions");
    if (c) {return true}
    else {
    alert ("You must agree the accept the terms and conditions before you can submit the form");
    return false;
    }
    }
    
    </script>
    
    </form>
    You can of course create your own modal dialog box using jQuery if you wish.

    Quizmaster: Who is married to the Duke of Edinburgh?
    Contestant: Kate Winslet.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.


  •  

    Posting Permissions

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