-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why am i getting a client side validation for boolean field in a collection list ? #71
Comments
The validation failure is caused by this: <input asp-for="PartSelections[i].IsSelected" type="hidden" /> You don't need to explicitly include that; I've added a demo to reproduce: #72. Without the explicit <form method="post">
<div class="form-field">
<label>
<input type="checkbox" data-val="true" data-val-required="The IsSelected field is required." id="Numbers_0__IsSelected" name="Numbers[0].IsSelected" value="true" class="input-validation-valid">
One
</label>
<input type="hidden" data-val="true" data-val-required="The Name field is required." id="Numbers_0__Name" name="Numbers[0].Name" value="One" class="input-validation-valid">
<!-- snip -->
<span class="field-validation-valid" data-valmsg-for="Numbers" data-valmsg-replace="true"></span>
<em class="results">Selected numbers: </em>
</div>
<input type="submit" value="Submit">
<input name="__RequestVerificationToken" type="hidden" value="...">
<input name="Numbers[0].IsSelected" type="hidden" value="false" class="input-validation-valid">
<input name="Numbers[1].IsSelected" type="hidden" value="false" class="input-validation-valid">
<input name="Numbers[2].IsSelected" type="hidden" value="false" class="input-validation-valid">
</form> Including it adds an extra <input type="hidden" id="Numbers_0__IsSelected" name="Numbers[0].IsSelected" value="False" class="input-validation-valid"> Specifically we're confused by aspnet-client-validation/src/index.ts Lines 138 to 146 in ed09a05
We could certainly patch that to also allow |
I verify that it works. For some reason i had it there before moving from jquery validation |
Im getting the following client side error when clicking submit button :
viewmodel
view
The text was updated successfully, but these errors were encountered: