Ciaran Gallagher
Ciaran Gallagher

Reputation: 4030

JQuery Validation showing "Please enter a multiple of 0.01" on HTML number textbox

I have an ASP.NET MVC5 project which uses the built-in jQuery validation library.

I have declared a textbox that is to accept a number that must be to two decimal places:

@Html.TextBox("", Model, new
{
    @class = "form-control",
    type ="number",
    placeholder ="0.00",
    step = "0.01"
})

When the page renders, I can't get this field to pass validation, no matter what I enter in the field, e.g. "100.22".

The validation error is:

"Please enter a multiple of 0.01".

Any ideas why this would happen?

I'm also using FluentValidation, but I've only used a NotEmpty() and GreaterThan(0) validation.

Upvotes: 0

Views: 3600

Answers (1)

J. Almandos
J. Almandos

Reputation: 347

The problem must be related with the syntax. Try entering the numbers with "," instead of "."

Upvotes: 2

Related Questions