javascript - Validation, how it make in jquery -
I have two main fields: Paceel
and Nip
.
But if someone else is full, then it is not enough to fill it.
For example, if I complete the field Nip
, then I do not have to fill the field Pesel
, but I can do it I am Validate $ ("# form1") ({submitHandler: function {form} Required: true, email: true}, nazivosco: {// compound rules required: true,}, sid: {required: true, meanline: 9, sid: true}, pecel: {minlength: 11, pesel: true} Nip: {required: true},}}); }); & Lt; / Script & gt;
I download it from the link:
on the basis , You will need to use the need_from_group
method, where you will need to assign paycell
and nip
to a group:
// script was compressed with $ $ ("#Form1"). Validate ({Rule: {pesel: {require_from_group: [1, ".example-group"]}, NIP: {require_from_group: [1, ".example-group"]}}});
I set this up, we have this form:
& lt; Form id = "myform" & gt; & Lt; Label = "pecel" & gt; Pace: & lt; / Label & gt; & Lt; Input class = "left-example-group" id = "pesel" name = "pesel" & gt; & Lt; Br / & gt; & Lt; Label = "nip" & gt; Nip: & lt; / Label & gt; & Lt; Input class = "left example-group" id = "nip" name = "nip" & gt; & Lt; Br / & gt; & Lt; Input type = "submit" value = "valid!" / & Gt; & Lt; / Form & gt; Note the class provided to scripts .example-group
, which will tell what field's combo feature ( nip
+ < Code> Paysel
). Edit: must be included
Comments
Post a Comment