私は、検証とAJAXリクエストを含むWebフォームをバックグラウンドで構築しています。私の問題は、すべての検証が正しく行われた後に、送信ボタンにアニメーションのみを実行させたいということです。jQueryは検証後にのみアニメーションを実行します
//jQuery ANIMATION
$("#submit1").click(function(){
$("#initial_form").animate({"left": "-=750px",opacity: 0.25,}) .fadeOut(1);
$("#ipad_congratulations").delay(500) .fadeIn("slow");
});
//VALIDATION
<script type="text/javascript">
/* <![CDATA[ */
jQuery(function(){
jQuery("#firstname").validate({
expression: "if (VAL) return true; else return false;",
message: "<br /> First name please."
});
jQuery("#lastname").validate({
expression: "if (VAL) return true; else return false;",
message: "<br />Last name too."
});
jQuery("#ValidNumber").validate({
expression: "if (!isNaN(VAL) && VAL) return true; else return false;",
message: "Please enter a valid Zip Code"
});
jQuery("#ValidInteger").validate({
expression: "if (VAL.match(/^[0-9]*$/) && VAL) return true; else return false;",
message: "Please enter a valid integer"
});
jQuery("#ValidDate").validate({
expression: "if (!isValidDate(parseInt(VAL.split('-')[2]), parseInt(VAL.split('-')[0]), parseInt(VAL.split('-')[1]))) return false; else return true;",
message: "Please enter a valid Date"
});
jQuery("#usremail").validate({
expression: "if (VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/)) return true; else return false;",
message: "<br />Please enter a valid Email Addres"
});
jQuery("#ValidPassword").validate({
expression: "if (VAL.length > 5 && VAL) return true; else return false;",
message: "Please enter a valid Password"
});
jQuery("#ValidConfirmPassword").validate({
expression: "if ((VAL == jQuery('#ValidPassword').val()) && VAL) return true; else return false;",
message: "Confirm password field doesn't match the password field"
});
jQuery("#ValidSelection").validate({
expression: "if (VAL != '0') return true; else return false;",
message: "Please make a selection"
});
jQuery("#ValidMultiSelection").validate({
expression: "if (VAL) return true; else return false;",
message: "Please make a selection"
});
jQuery("#ValidRadio").validate({
expression: "if (isChecked(SelfID)) return true; else return false;",
message: "Please select a radio button"
});
jQuery("#resident").validate({
expression: "if (isChecked(SelfID)) return true; else return false;",
message: ""
});
jQuery("#terms").validate({
expression: "if (isChecked(SelfID)) return true; else return false;",
message: ""
});
});
/* ]]> */
</script>
$(function(){
$('#form').form({
success:function(data){
$.messager.alert('Info', data, 'info');
}
});
});
</script>
検証はどこですか? –