Good day! There was a problem with the implementation of such that if you select a value in one selecte, then the values change in another. For example, there is a list of departments of the hospital and when choosing a particular department in select, the doctors of this particular department are displayed. The bottom line is that if you select a value in select departments, and then send it to a servlet to change the value in select doctors, the list of specific doctors changes, and the value of the department selection returns to the initial one. Question: how to implement it so that after sending the form to the servlet and displaying the select with specific doctors, the value of the first select does not change?
Here is my code:
<form class="form-horizontal" action="controller" method="POST"> <input type="hidden" name="command" value="insertNewReception"/> Отделение: <select class="selectpicker"> <option onclick="location.href='/Task/controller?command=listCategory&category=neurologCategory&reception=new';"> <c:if test="${category=='Невропатологическое'}"> <c:out value="${category}"></c:out> </c:if> </option> <option onclick="location.href='/Task/controller?command=listCategory&category=oftalmologCategory&reception=new';"> <c:if test="${category=='Офтальмологическое'}"> <c:out value="${category}"></c:out> </c:if> </option> <option onclick="location.href='/Task/controller?command=listCategory&category=pediatrCategory&reception=new';"> <c:if test="${category=='Детское'}"> <c:out value="${category}"></c:out> </c:if> </option> <option onclick="location.href='/Task/controller?command=listCategory&category=terapevtCategory&reception=new';"> <c:if test="${category=='Терапевтическое'}"> <c:out value="${category}"></c:out> </c:if> </option> </select> Врач: <select class="selectpicker"> <c:forEach var="doctor" items="${listCategoryDoctors}"> <option>${doctor.lastName}</option> </c:forEach> </select> <button type="submit" class="btn btn-primary">Записать</button> <br/> </form>
I will be glad to any answer!