I wanted to have a dynamic form where the only thing that is asked is to select a user u from a list of users passed to the model from a controller, the email and status fields should be automatically displayed depending on the user who is selected.
The user object has the following class:
public class Utilizador{
private String perfil;
private String email;
private string estado;
...
}
The form elements are organized as follows:
<dl th:class="form-group">
<dt>perfil:</dt>
<dd>
<select class="form-control" th:field="*{hhFrom}">
<option th:each=" u : ${utilizadores}" th:value=""
th:text="${u.perfil}">Options
</option>
</select>
</dd>
<dt>email:</dt>
<dd th:text="${u.email}></dd>
<dt>estado:</dt>
<dd th:text="${u.estado}></dd>
</dl>
I am aware that th: text="$ {u.email} and th: text=" $ {u.status} are pointing to a user-type object that is not visible where they are, but my goal was to get around this problem in some way.