/    Sign up×
Community /Pin to ProfileBookmark

jQuery on submit validation, with modal dialog at the end?

I have a form at the moment I’d like to validate, and assuming everything is correct, I’d like it to then popup a dialog confirming their details, here’s an example of the code I have so far:

[CODE]var userConfirmed = false;

$(“#dialog”).dialog({
buttons: {
“Yes”: function() {
userConfirmed = true;
$(“#inputform”).submit();
},
“No, I’ll change them.”: function() {
$(this).dialog(“close”);
}
}
});

// check they’ve submitted what they need to
$(“form”).submit(function() {

// lots of these
if (something) {
return false;
}

$(“#dialog”).dialog(“open”);

return userConfirmed;

});[/CODE]

The initial validation works fine – it checks against the criteria and flags up as appropiate, and if none of that criteria is met, it’ll display the modal box just as I want. So far, so good.

The problem however is when I press ‘yes’ to submit the form, it doesn’t submit, until you press the actual ‘submit’ button again, argh!

Any suggestions would be very welcome, thank you.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @blizeH spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...