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 4 of 4
  1. #1
    New Coder
    Join Date
    Sep 2012
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with Imprompty modal box not working correctly

    I'm using the jQuery Impromptu plugin ( http://trentrichardson.com/Impromptu/)

    The plugin is working as expected, except for the fact that when a user clicks on the 'Submit' button on the form, it still loads the form automatically instead of waiting for the user to click on 'Ok' or 'Cancel' on the dialog box.

    You can test the form here http://mcgehee.ace-onecomputers.com/test/
    (you don't have to fill out the form, you can just click submit)

    view the source to see my coding...

    any reason or fixes as to why it still loads the form? is there any way to post-pone this to give the user time to read the content of the dialog box and select an option before the form loads?

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    ok, first things first. You have several jQuery dependent scripts loading before jQuery , never a good idea.

    ok to answer your question. You applied go_there() to the submit button itself. part of the function fires the submit event of your form programatically, thsi is also part of the issue. You should hook this function directly into the submit event of your form, as a user could circumvent your code without much effort.

    try this instead
    Code:
    $(function(){
    $('#contactform').submit(function(e){
    //prevent default form submittal event
    e.preventDefault();
    
       $.prompt('<b>DISCLAIMER</b> <span style="font-weight:normal">TEXT WILL GO HERE</span>',{
           buttons: { Ok: true, Cancel: false}, 
           callback: function(e,v,m,f){
              if(v){
    
    				 document.getElementById("contactForm").submit();
    			 
              }else{
    
              }
           }
       });
    })
    })
    Oh also you are missing the closing </form> tag

  • #3
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    if you want to this only on click for some reason ( remember users can submit the form by pressing enter in input fields in many browsers) jsut change
    Code:
    $('#contactform').submit(function(e){
    to

    Code:
     $('#submit').click(function(e){

  • #4
    New Coder
    Join Date
    Sep 2012
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The only issue with this, is that it does not actually send the form. it does nothing but close the dialog box.


  •  

    Posting Permissions

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