如何确保在表单有效并正确提交之前窗口不会关闭?因为现在它关闭了弹出窗口并且没有人知道表单是否有效。因为即使出现错误,表格也会立即关闭。
$(document).ready(function(){
$(".requestPassword").hide();
$(".popupwindow").popupwindow(profiles);
$(".fp").click(function(){
$(".loginForm").hide();
$(".requestPassword").show();
});
$(".back").click(function(){
$(".loginForm").show();
$(".requestPassword").hide();
});
//form validation
$("#aanmeldForm").validate({
//set the rules for the field names
rules: {
firstname: {
required: true,
minlength: 2
},
email: {
required: true,
email: true
},
message: {
required: true,
minlength: 2
},
},
//set messages to appear inline
messages: {
name: "Please enter your name",
email: "Please enter a valid email address"
},
errorPlacement: function(error, element) {
error.appendTo( element.parent("td"));
}
});
$("#aanmeldForm").submit(function(){
//TODO: some data keeping jobs to be done
self.opener.location = 'http://ladosa.com';
self.close();
});
});