Response title
This is preview!
popupbeforeposition
event isn't being fired, or isn't being fired at the correct time./* Options Menu */
$("#OptionsMenuPanel").on({
popupbeforeposition: function () {
var h = $(window).height();
$("#OptionsMenuPanel").css("height", h);
}
});
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>JQuery Validation Test</title>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.min.js" type="text/javascript"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8/jquery.validate.js" type="text/javascript"></script>
</head>
<body>
<form action="#">
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$("#btnSubmit1").click(function() { $("div#form1").validate(); });
$("#btnSubmit2").click(function() { $("div#form2").validate(); });
});
</script>
<div id="form1">
<h1>Form 1</h1>
<div class="outer-container">
<div class="input-container">
<label for="txtName1" class="label">Name:</label>
<input type="text" name="txtName1" id="txtName1" class="required" />
</div>
<div class="input-container">
<label for="txtEmail1" class="label">Email:</label>
<input type="text" name="txtEmail1" id="txtEmail1" class="required email" />
</div>
</div>
<div class="submit-button-container">
<button id="btnSubmit1" class="btn-submit-1">Submit</button>
</div>
</div>
<div id="form2">
<h1>Form 2</h1>
<div class="outer-container">
<div class="input-container">
<label for="txtName2" class="label">Name:</label>
<input type="text" name="txtName2" id="txtName2" class="required" />
</div>
<div class="input-container">
<label for="txtEmail2" class="label">Email:</label>
<input type="text" name="txtEmail2" id="txtEmail2" class="required email" />
</div>
</div>
<div class="submit-button-container">
<button id="btnSubmit2" class="btn-submit-2">Submit</button>
</div>
</div>
</form>
</body>
</html>
What I was hoping to do is to tie into the SubmitHandler of the validation plugin to
execute my custom ajax method, like this:
$(document).ready(function() {
$("#btnSubmit1").click(function() {
$("div#form1").validate({
submitHandler: function(form) {
// execute my ajax method here
}
});
});
});
That's idea anyway. I'm not sure that I fully understand the documentation for the Validation plugin, but it doesn't seem like this is possible, as the plugin seems to need a <form> for each form.
Thanks for any help,
Kaine
© 2013 jQuery Foundation
Sponsored by and others.