jQuery Validierung von ID-und form-Gruppe

Brauche ich, um zu überprüfen, die von id-und nicht input-Namen, weil mein input name data[name]. Ich habe auch eine Regel zum zulassen eines oder beide Felder.

Ich hinzufügen kann, der die Regeln mit id, aber ich kann nicht verbinden die beiden Regeln. Gibt es eine Möglichkeit.

<input id="email" type="email" class="form-control contact-method" name="data[email]" placeholder="Email">
<input id="phone" type="text" class="form-control contact-method" name="data[phone]" placeholder="Phone">

Js-Code:

$('#requestDemo').validate({  //<- attach '.validate()' to your form
    debug: false,
    errorElement: "span",
    errorClass: "help-block",
    rules: {
        phoneInput: {
            require_from_group: [1, ".contact-method"]
        },
        emailInput: {
            require_from_group: [1, ".contact-method"]
        }
    },
InformationsquelleAutor Keith Power | 2015-02-18
Schreibe einen Kommentar