...

View Full Version : Help with Imprompty modal box not working correctly



pthornt1
11-02-2012, 07:08 PM
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?

DanInMa
11-02-2012, 09:44 PM
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


$(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

DanInMa
11-02-2012, 09:46 PM
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
$('#contactform').submit(function(e){

to


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

pthornt1
11-02-2012, 10:08 PM
The only issue with this, is that it does not actually send the form. it does nothing but close the dialog box.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum