I have an html page where the designation of employees can be selected via a drop down menu. And the selected option in the drop down menu displays employees of that corresponding designation. I am able to display the employees on selecting the designation from drop-down menu. The choices in drop-down are 'Select A Designation','Trainee','Software Engineer','Project Manager','Tester' etc. Even though the employees are listed correctly based on designation, the option in drop down always remains 'Select a designation' (which is the first option in drop-down).Please help: *MY * Sorry for the poor indentation, i couldn't find how to enter html code here. HTML IS :
<form action="http://10.1.0.90:8080/filter/" method="POST">
Designation:<select name="designation" onchange="document.forms[0].submit()" selected="True">
<option value="" selected>Select A Designation</option>
<option value="Trainee">Trainee</option>
<option value="Software Engineer Trainee">Software Engineer Trainee</option>
<option value="Software Engineer">Software Engineer</option >
<option value="Senior Software Engineer">Senior Software Engineer</option>
<option value="Project Manager">Project Manager</option>
<option value="System Administrator">System Administrator</option>
<option value="Tester">Tester</option>
</select>
My views of Django is:
def filter(request):
newData = EmployeeDetails.objects.filter(designation=request.POST.get('designation'))
return render_to_response('filter.html',{'newData':newData})