I am using Parsley validator validating my JSP form. However I am having an issue when validating numbers. Please have a look at the below code.
<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 may contain the floating numbers, not only the integers. Numbers like 5500.65 must be allowed. But the parsley validator is checking for "integers" and not submitting the form if it is containing double numbers.
How can I solve this issue?
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 this helps : )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With