Validate minimum number of characters in textarea?

Asked

Viewed 722 times

0

Good people, I need to validate a textarea field in an application using Thymeleaf, to limit the maximum amount I have already managed, but I don’t know how to validate the minimum amount.

  • 1

    How is your code?

  • I did, I thought only add minlength="Qtd" not working directly in HTML, but it worked.

1 answer

1

I got it, just add minlength=" " with the amount I needed that worked.

<textarea class="form-control" id="inputAnswer" placeholder="Enter Question" th:field="*{answer}" minlength="50" maxlength="255">
                            <span th:if="${#fields.hasErrors('answer')}" th:errors="*{answer}" th:class="help-block" />
</textarea>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.