I'm developing a CRUD from a web system. In the employee's registry I use two select elements to display the options, when registering everything works ok, the information goes to the bank. The problem is when you click edit and bring this information to select, the select the edit screen comes with the initial value of the select; example: in the register I put that I am support, when editing the field select this administrator and not the correct one, support. Someone can help me to bring the correct information of these selects.
Register screen where you enter the options SUPERVISOR AND SUPPORT
Ontheeditscreen,thefieldsappearasadministrator.
Mystaffform
<divclass="row">
<form action="@{funcionarios.salvarFuncionarios}" method="post">
<div class="col-lg-6">
<input type="hidden" name="funcionario.id" value="${f?.id}" />
<div class="form-group">
<label>Nome completo:</label> <input type="text"
name="funcionario.nome" class="form-control"
value="${flash['funcionario.nome'] ? flash['funcionario.nome'] : f?.nome}">
<span class="alert-danger">#{error 'funcionario.nome' /}</span>
</div>
<div class="form-group">
<label>Email:</label> <input type="text" name="funcionario.email"
class="form-control"
value="${flash['funcionario.email'] ? flash['funcionario.email'] : f?.email}">
<span class="alert-danger">#{error 'funcionario.email' /}</span>
</div>
<div class="form-group">
<label>Função:</label> <select name="funcionario.funcao"
class="form-control"
value="${flash['funcionario.funcao'] ? flash['funcionario.funcao'] : f?.funcao}">
<option>Administrador</option>
<option>Suporte</option>
<option>Supervisor</option>
</select> <span class="alert-danger">#{error 'funcionario.funcao' /}</span>
</div>
<div class="form-group">
<label>Nível de acesso:</label> <select
name="funcionario.nivelAcesso" class="form-control"
value="${flash['funcionario.nivelAcesso'] ? flash['funcionario.nivelAcesso'] : f?.nivelAcesso}">
<option>Administrador</option>
<option>Suporte</option>
</select> <span class="alert-danger">#{error 'funcionario.nivelAcesso'
/}</span>
</div>
</div>
<div class="col-lg-6">
#{if f}
<div class="form-group">
<label>Nome de usuário:</label> <input id="loginUsuario" type="text" placeholder="Mínimo 5 caracteres"
name="funcionario.login" class="form-control" disabled="disabled"
value="${flash['funcionario.login'] ? flash['funcionario.login'] : f?.login}">
<span class="alert-danger">#{error 'funcionario.login' /}</span>
</div>
#{/if}
#{ifnot f}
<div class="form-group">
<label>Nome de usuário:</label> <input id="loginUsuario" type="text" placeholder="Mínimo 5 caracteres"
name="funcionario.login" class="form-control"
value="${flash['funcionario.login'] ? flash['funcionario.login'] : f?.login}">
<span class="alert-danger">#{error 'funcionario.login' /}</span>
</div>
<div class="form-group">
<label>Senha:</label> <input type="password" placeholder="Mínimo 6 caracteres"
name="funcionario.senha" class="form-control"
value="${flash['funcionario.senha'] ? flash['funcionario.senha'] : f?.senha}">
<span class="alert-danger">#{error 'funcionario.senha' /}</span>
</div>
<div class="form-group">
<label>Confirmar senha:</label> <input type="password" name="senha"
class="form-control"> <span class="alert-danger">#{error
'senha' /}</span>
</div>
#{/ifnot}
</div>
<div class="col-lg-12">
<button type="submit" class="btn btn-success">Salvar</button>
<button type="reset" class="btn btn-danger"
onclick="window.location.href='/funcionarios/listagemFuncionarios';">
Cancelar</button>
</div>
</form>