The form has an input field which is validated remotely using the remote validator to check if it is available or not.
Having duplicate values is allowed. In this instance, it's still possible to submit the
form. I just want to warn the user by adding the warning class (has-warning)
provided by Bootstrap to the form group.
Solution
Assume that the field name is userName and we use the remote validator to check
its existence against the database.
In the case it is already taken in the database, we response an JSON encoded string of
following object
The message property is used to shown in the form.
The available property is a custom property indicating the value is not
available. We can reuse it later. Of course, you can change its name to other one to suit
with your requirement.
Next, trigger the success.validator.fv and err.validator.fvevents to add (remove) has-warning to
(from) the form group.
For testing purpose, the back-end always responses that
the user name is not available no matter what you type in the field