Custom Plugin Validator

1 mês atrás

I have a custom plugin and I add my validator class but not all the rules applied to the property.
the NotNull rule works fine but greater and less than not working

My Validator Class inherit from BaseNopValidator<MyModel>

RuleFor(x => x.WithdrawalAmount).NotNull().WithMessageAwait("My Error Msg");
RuleFor(x => x.WithdrawalAmount).GreaterThan(0).WithMessageAwait("My Error Msg");
RuleFor(x => x.WithdrawalAmount).LessThan(x => x.CurrentCredit).WithMessageAwait("");

My cshtml class:

<div class="inputs">
                   <label asp-for="WithdrawalAmount" asp-postfix=":"></label>
                   <nop-editor asp-for="WithdrawalAmount" />
                   <nop-required />
                  <span asp-validation-for="WithdrawalAmount"></span>

Any advice
1 mês atrás
I get it. the greater and less than not a client-side validators