In the view,
<select id="gender" ng-model="gender">
<option value=''>Gender?</option>
<option value="female" >Female</option>
<option value="male" >Male</option>
<option value="other" >Other</option>
</select>
<input type="hidden" name="gender" value="{{gender}}">
On submit error, the submitted value is retrived and put as the select value,
var theValue = "<?php echo set_value('gender');?>";
var e = document.getElementById("gender");
e.value = theValue;
On submitting the incomplete form, the select should retain the post value, and momentarily it does, but resets again. How do I prevent the select to reset and keep the value?