Welcome Guest, Not a member yet? Register   Sign In
Clearing a select box after form submit.
#1

Code:
<select class="form-control" id="project_type" name="project_type">
<option value="">Select..</option>
<?php foreach ($project_types as $value): ?>
<option value="<?= $value['PROJTYP_CODE'] ?>" <?= set_select('project_type', $value['PROJTYP_CODE']); ?>><?= $value['PROJTYP_CODE'].' - '.$value['PROJTYP_DSC'] ?></option>
<?php endforeach ?>
</select>

I have a select box that I am dynamically creating options for with php and repopulating the input with CI's set_select().

Everything works as expected but when I try to clear the form, the repopulated option acts as the selectedIndex ( as it should ) and I can't reset the input to the top option. I've tried a couple solutions with jQuery but had no luck.

Has any one else ran into this issue? if so how did you handle it?
Reply


Messages In This Thread
Clearing a select box after form submit. - by BrandenM - 02-12-2015, 06:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB