Trisha
Trisha

Reputation: 539

stop page from loading after dialog box opens

What I'm trying to do is have a contact form, and when the user hits submit a dialog box appears asking the user to confirm yes/no, and the form should not submit until the user has selected yes, or stays on the page when selects no.

What my issue is, once the dialog box opens, the form still submits, and the dialog box is open for only a second or so.

So is it possible to stop the page from loading until after the dialog box is closed or yes is clicked?

I'm using the jQuery Impromptu plugin for the dialog box.

Upvotes: 1

Views: 581

Answers (2)

Angus Atkins-Trimnell
Angus Atkins-Trimnell

Reputation: 121

I'm not familiar with the impromptu library; however, I believe that this can be done by stopping the onClick event from submitting and submitting via the callback in your go_there() method. I would try replacing the onClick method with "go_there(); return false;". This should cancel the normal submit event. Then you could add a submit statement (document.email.submit();) in the true condition of your callback before you reset the location.

Upvotes: 1

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114367

Don't use type="submit", just use type="button". Submit the form from your own code based on the dialog result.

Upvotes: 1

Related Questions