I would like to know how can I trim an input value before send it to the controller with Thymeleaf?
I'm using Spring MVC and Thymeleaf as a template engine.
Bellow the code of my form:
<form id="collabForm" method="post" action="#" th:action="@{/collaborateurs/add}" role="form" th:object="${newCollaborateur}">
<div class="box-body">
<div class="form-group col-sm-6 col-md-4 col-lg-4">
<label for="nomCollab">Nom</label>
<input id="nomCollab" class="form-control" name="nom" type="text" placeholder="Saisir le nom" th:field="*{nom}" required="required"/>
</div>
</div>
</form>
Thanks a lot!
My Solution