Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ValidationSummary.ModelOnly fails but ValidationSummary.All works

Tags:

asp.net-core

This is strange. For some reason, this fails:

<div asp-validation-summary="ValidationSummary.ModelOnly"></div>

But this one works just fine:

<div asp-validation-summary="All"></div>

Any one would know why? Here is entire code snippet:

<div class="row">
<div class="col-md-6 col-md-offset-3">
    <h3>Login</h3>
    <form method="post" novalidate>
        <div asp-validation-summary="All"></div>
        @*<div asp-validation-summary="ValidationSummary.ModelOnly"></div>*@
        <div class="form-group">
            <label asp-for="Username"></label>
            <input type="text" asp-for="Username" class="form-control" />
            <span asp-validation-for="Username"></span>
        </div>
        <div class="form-group">
            <label asp-for="Password"></label>
            <input type="password" asp-for="Password" class="form-control" />
            <span asp-validation-for="Password"></span>
        </div>
        <div class="form-group">
            <input type="submit" value="Login" class="btn btn-success" />
        </div>
    </form>
</div>

like image 609
lucas Avatar asked Feb 07 '23 09:02

lucas


1 Answers

I'm assuming you are using asp.net core 1.0. The value for the validation-summary tag helper was changed from

<div asp-validation-summary="ValidationSummary.ModelOnly"></div>

to simply

<div asp-validation-summary="ModelOnly"></div>

You did it correclty with All ;-)

asp.net core docs

like image 168
ypsilo0n Avatar answered May 21 '23 02:05

ypsilo0n