开发者

How to go to next step in a multipart form (after validation)

I am using the jQuery Validation plugin on the UI Accordion. I would like to open the next accordion after the validation is run without errors. I know this is a very basic function, but I can't figure out how to do it. Any suggestions?

$(document).ready(function(){
$("#applicant-form").validate({
  errorPlacement: function(error,element) {
    return true;
  },
  rules: {
    "firstName": {
      required: true,
      minlength: 2
    }
  },
}开发者_StackOverflow);

$(".next-step").click(function(e){
  e.preventDefault();
  var acc = $("#accordion"),
  index = acc.accordion('option','active'),
  total = acc.children('div').length,
  nxt = index + 1;

  acc.accordion('activate', nxt);
});


You can do separate forms, and use the submitHandler option in the Validation to switch the Accordion.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜