Today I stumbled across a problem with the number input in a hmtl Form. I'm trying to get an Input from the User in form of a float. For this case i use the Input tag as following (Sorry for the English/German names):
<input asp-for="TBE_Leitwert" type="number" step="0.1" class="form-control" placeholder="Leitwert (mS)" />
Somehow after submitting the form I don't get the float value. It seems like the Input is ignoring the separator at all, Example:
The User puts in the value 1,1 but submitted was 11.
Value entered from a user:
Value from submitted the form:
The same problem results, even if I put the value 1.1 so it doesn't matter if I take the dot or comma, the value still is submitted wrong as 11
Is there any way to get the right float values from submitting the form without using JS or AJAX?
Edit: I made a super minimal reproducible exampele.
Index Page:
@model TestModel
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<form asp-controller="Home" asp-action="GetValue">
<input asp-for="WantedValue" type="number" step="0.1" />
<button type="submit">Test</button>
</form>
</div>
HomeController just added this 1 function:
public IActionResult GetValue(TestModel test)
{
return RedirectToAction("Index");
}
Model:
public class TestModel
{
public double WantedValue { get; set; }
}
it is still the same, if i enter a float value on the index:
Value entered by User on Index
the Controller still gets a wrong value:
Wrong Value received from Form
since i entered "1,1" on the Index site i was expecting to get the value "1,1" in the controller. Same with the Value "1.1"

