Quantcast
Channel: Fluent Validation for .NET
Viewing all articles
Browse latest Browse all 1917

Created Unassigned: Possible GreaterThanOrEqualToValidator Bug in Version 5.5 [7200]

$
0
0
Today, we updated to the latest version of the Fluent Validation NuGet package (5.5) from 30/10/2014 and it seems to have introduced a bug into out web application when using GreaterThanOrEqualTo.

In the changelog, we did see that this, along with LessThanOrEqualTo, are supposed to be working on the client side now, and the GreaterThanOrEqualTo validation does seem to be firing. However, it does not seem to be evaluating the values that we have inside of our KendoNumericTextBoxes.

Here is a sample of the client-side code that we have:

```
@Html.LabelFor(m => m.Shift1RateDifferential, "Rate 1:", new { @class = "control-label col-md-2" })
<div class="col-md-2">
@(Html.Kendo().NumericTextBoxFor<decimal>(m => m.Shift1RateDifferential)
.Name("Shift1RateDifferential")
.Min(0)
.HtmlAttributes(new { @class = "textboxFocus" })
)
@Html.ValidationMessageFor(m => m.Shift1RateDifferential)
</div>
```

The KendoNumericTextBox, using the Min attribute will not even allow the entry of a number below zero, yet the client-side validation keeps throwing the error from GreatThanOrEqualTo(0), as seen below on our API side.

```
RuleFor(x => x.Shift1RateDifferential).NotNull()
.GreaterThanOrEqualTo(0)
.WithMessage("{PropertyName}" + VALIDATIONS.NUM_GREATER_EQUAL + "{ComparisonValue}")
.SetValidator(new LengthValidator(0, 10))
.WithMessage("{PropertyName}" + VALIDATIONS.LENGTH_NOT_GREATER + "{MaxLength}");
```

My question is: is this a bug; or are we not using the rule correctly?

Any help would be much appreciated.

Thanks!

Viewing all articles
Browse latest Browse all 1917

Trending Articles



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