Hi Team
I am struggling to make my textbox when leaving to have one label error message, i have done it well on one textbox('email). But trying to apply similar logic to these texbox is bit tricky and need some guidance around my logic below.
What I have tried:
<pre lang="HTML"><pre> <div class="row">
<label for="Address">Address</label>
<div class="col-md-6 ">
<div class="input-group pull-right">
@Html.TextBoxFor(m => m.HomeMainModel.Address, new { @class = "form-control", type = "text", id = " street address", autofocus = "autofocus", placeholder = "Street Address", required = "required" })
<div class="input-group-append">
<div class="input-group-text">
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6 col-sm-10 col-xs-10">
<label id="labelMessaget" class="text-danger" style="display:none"></label>
</div>
<div class="row">
<div class="col-md-6 ">
<div class="input-group pull-right">
@Html.TextBoxFor(m => m.HomeMainModel.Address, new { @class = "form-control", type = "text", id = "address", autofocus = "autofocus", placeholder = "Street Address Line 2", required = "required" })
<div class="input-group-append">
<div class="input-group-text">
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6 col-sm-10 col-xs-10">
<label id="labelMessaget" class="text-danger" style="display:none"></label>
</div>
<div class="form-group">
<div class="input-group mb-2">
<div class="input-group-prepend">
</div>
<div class="input-group col-md-7 col-md-offset-7 col-sm-7 col-xs-7">
<div class="input-group pull-right">
@Html.TextBoxFor(m => m.HomeMainModel.City, new { @class = "form-control", type = "text", id = "city", autofocus = "autofocus", placeholder = "City", required = "required" })
@Html.TextBoxFor(m => m.HomeMainModel.State, new { @class = "form-control", type = "text", id = "state", autofocus = "autofocus", placeholder = "State/ Province", required = "required" })
<div class="input-group-append">
<div class="input-group-text">
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6 col-sm-10 col-xs-10">
<label id="labelMessaget" class="text-danger" style="display:none"></label>
</div>
<hr />
<!--Zip code for postal code-->
<div class="input-group mb-2">
<div class="input-group-append">
</div>
<div class="input-group col-md-7 col-md-offset-3 col-sm-2 col-xs-2">
<div class="input-group pull-right">
@Html.TextBoxFor(m => m.HomeMainModel.Code, new
{
@class = "form-control",
type = "text",
id = "postal code",
autofocus = "autofocus",
placeholder = "Postal/Zip Code"
})
@Html.DropDownListFor(m => m.HomeMainModel.SelectedCountryId, this.ViewBag.CountryList as SelectList, new { @class = "form-control" })
<div class="input-group-append">
<div class="input-group-text">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6 col-sm-10 col-xs-10">
<label id="labelMessaget" class="text-danger" style="display:none"></label>
</div>