Failed to check "floating numbers" with validator check

I am using Parsley validator validating my JSP form. However, when checking the numbers, I have a problem. Please see the code below.

<form class="form-horizontal" method="post" action="" data-parsley-validate>
    <input id="textinput" name="salary" type="number" required class="form-control input-md" value=<c:out value="${designationInfo.salary}"/> >
</form>

      

The number field can contain floating numbers, not just integers. Numbers such as 5500.65 should be allowed. But the loop validator checks for "integers" and does not submit the form if it contains double numbers.

How can I solve this problem?

+3


source to share


1 answer


According to this GitHub issue thread , I think you can add a step attribute to your input element like this:

    <form class="form-horizontal" method="post" action="" data-parsley-validate>
        <input id="textinput" name="salary" type="number" step="0.01" required class="form-control input-md" value=<c:out value="${designationInfo.salary}"/> >
    </form>

      



Hope it helps :)

+7


source







All Articles