javascript - Why does the JQuery Validate plugin automatically initialize the validation for my form? -
hey there stackoverflow
edit: im using asp.net mvc framework
i've been struggling problem 2 days , can't seem understand why happens. i'm adding client-side validation form(multiple forms actually). fine , working on other forms, added form @html.dropdownlistfor() form , seems that causes validator initialize automatically field, making impossible me put own validation on form (you cant initialize validation more once.)
does know why happens? know solution problem?
my viewmodel:
public class verkooptariefviewmodel { public list<leverancier> leveranciers { get; set; } public int leverancierid { get; set; } public verkooptarief verkooptarief { get; set; } }
my form:
<tr> <td><b>leverancier</b></td> <td class="col-md-6"> <div class="form-group editverkooptariefformgroup"> @html.dropdownlistfor(i => i.leverancierid, new selectlist(model.leveranciers, "id", "naam", model.verkooptarief.leverancier.id), new { @class = "form-control editverkooptariefinput", @disabled = "disabled" }) @html.validationmessagefor(t => t.verkooptarief.leverancier, null, new { @class = "text-danger" }) </div> </td> </tr> <tr> <td><b>debiteurnummer</b></td> <td class="col-md-6"> <div class="form-group editverkooptariefformgroup"> <input type="text" name="verkooptarief.debiteurnummer" class="form-control editverkooptariefinput" value="@model.verkooptarief.debiteurnummer" disabled /> @html.validationmessagefor(t => t.verkooptarief.debiteurnummer, null, new { @class = "text-danger" }) </div> </td> </tr>
the validation automatically puts on form:
the options send validator put on form:
so remember, there nothing wrong validator receiving options wrong way or anything. it's @html.dropdownlistfor() makes validator initialize without me wanting it. (because initializes validator, cant send own options validator because cant initialize more once.)
all other forms without @html.dropdownlistfor() work fine.
Comments
Post a Comment