i have a drop down list and the client must select a value then it will be persist in mysql db okay i did that but i want when the client select a value i get that value and i do an if statement exemple :
if selected value is : CIN then compte.setcomptenumber(25364138); like that
this my controller :
@RequestMapping(value="/addClient")
public String addClient (Model model) {
Client client= new Client();
Compte compte = new Compte();
Agence agence = new Agence();
//Carte carte = new Carte();
model.addAttribute("client",client);
List<String> typepieceList = Arrays.asList("CIN","Passeport");
return "client";
}
my html :
<div class="p-col-12">
<label class="p1">Choisir Type de la pièce d'identité
</label> <br> <select th:field="*{typepieceClient}"
class="form-control" required="required">
<option value=""></option>
<option th:each="p: ${typepieceList}" th:value="${p}"
th:text="${p}" class="p1"></option>
</select>
</div>