How do I validate a form without submitting and go to other page with jquery mobile and Jquery validation?

后端 未结 2 1790
孤城傲影
孤城傲影 2020-12-21 15:51

So I\'m trying to validate a JQM form that has 4 parts and are divided in different pages so after I validate the first part I want to go to the second, if the form it\'s va

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-21 16:34

    Edit: clearly not a valid answer since the pages are in individual divs ;)

    Is there any reason you're using .bind like that?

    This section of validate code looks fine:

    $('#sampleProperties').validate({
      rules:{
        station: 'required',
        date: 'required',
        singleMultiContainer: 'required',
        containerCuantity:{
            required:'true',
            minlength:1,
            maxlength:40
        }
      },
      submitHandler: function(form) {
         alert('Success!');
      }
    });
    

    Conversely (your title is ambiguous) if you're wanting a way to validate the form without jquery.validate, you could simply bind some validation functions to the keyUp event on the various input boxes.

提交回复
热议问题