Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

why validation message on load

$
0
0

Hi 

I have simple below create form. It display validation message on load. I want user to click save to display validation message not on load.

@model CapCloud.Web.Models.Users.UserSettings

@{
ViewData["Title"] = "Create User";
}

@{
var hideClient = string.IsNullOrEmpty(Model.Client) ? "" : "hide";
}

@using (Html.BeginForm())
{
@Html.AntiForgeryToken()

<div class="row">
<div class="col-md-12 col-sm-12">
<div class="panel panel-default bootcards-richtext">

<div class="panel-heading">
<h4>Add New Client</h4>
</div>

<div class="form-horizontal">
<div class="modal-body">
@Html.ValidationSummary(false, "", new { @class = "text-danger" })

<div class="form-group">
<div class="col-md-2">
<label asp-for="UserName" class="control-label"></label>
</div>
<div class="col-md-10">
<input asp-for="UserName" class="form-control" placeholder="username" />
</div>
</div>

<div class="form-group">
<div class="col-md-2">
<label asp-for="FirstName" class="control-label"></label>
</div>
<div class="col-md-10">
<input asp-for="FirstName" class="form-control" placeholder="First Name" />
</div>
</div>

<div class="form-group">
<div class="col-md-2">
<label asp-for="LastName" class="control-label"></label>
</div>
<div class="col-md-10">
<input asp-for="LastName" class="form-control" placeholder="Surname" />
</div>
</div>

<div class="form-group">
<div class="col-md-2">
<label asp-for="EmailAddress" class="control-label"></label>
</div>
<div class="col-md-10">
<input asp-for="EmailAddress" class="form-control" placeholder="Enter your email address" />
</div>
</div>

</div>

<div class="panel-footer clearfix">
<div class="btn-group pull-left">
<button class="cancel btn btn-danger" data-dismiss="modal" asp-action="Index" formnovalidate>
Cancel
</button>
</div>

<div class="btn-group pull-right">
<button type="submit" class="btn btn-success" data-dismiss="modal">
Save
</button>
</div>
</div>
</div>
</div>
</div>
</div>
}


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>