Required Field validation

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
Hi there,

I am using nopcommerce 4.0. the required field validation not working  on Drop Down list. if any body using nopcommerce 4.0 you can see this while register new customer. can any body help me please.

this is the code in my validation classs

  RuleFor(x => x.StateProvinceId).NotEqual(0).WithMessage(localizationService.GetResource("Account.Fields.StateProvince.Required"));


and following is code in view


<div class="form-group">
                        <label class="control-label col-sm-3 col-md-3">State:</label>
                        <div class="col-sm-6 col-md-5">
                            <select class="form-control dropdown-toggle category-iteam" asp-for="StateProvinceId" asp-items="Model.AvailableStates"></select>
                            <span id="states-loading-progress" style="display: none;" class="please-wait">@T("Common.Wait...")</span>
                        </div>
                        <div class="col-sm-3 col-md-4">

                            <nop-required />

                            <span asp-validation-for="StateProvinceId"></span>
                            <span id="states-loading-progress" style="display: none;" class="please-wait">@T("Common.Wait...")</span>
                        </div>
                    </div>
5 years ago
Are you using default fields in nopcommerce? Required field validation should work as long as you have not done any customization.
5 years ago
I did not customize registration page required field validation not works with drop down list.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.