Thymleaf form with validator.js

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Thymleaf form with validator.js

Hello every one

I'm using validator.js from boottrap to create a register page.
my register page is very close of the exemple of the page : validator.js

In the server side, I'm using spring mvc. I would like to display an error when an email already exist.
In this case I would like that the input-group is marked as error with the error message.
Exactly the same as validator.js do when the email address is not well formatted.

This is the actual thymeleaf code to display the email input
<form id="form" class="" th:action="@{/signup}" method="post"


                        <div class="form-group has-feedback">
                            <label for="email" class="cols-sm-2 control-label">Your Email</label>
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"></i></span>
                                <input id="email" type="email" class="form-control" name="email"
                                       placeholder="Enter your Email" th:field="*{email}"/>
                            <span class="glyphicon form-control-feedback" aria-hidden="true"></span>
                            <div class="help-block with-errors"></div>


        <script src=""></script>

How can do that without being in conflict with validator.js which works well ?
I hope I explain well my problem.

Thanks :)