CodeIgniter Forums
DISREGARD / CANT DELETE A POST?? | form_dropdown selected working but not showing as selected in view to user. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: DISREGARD / CANT DELETE A POST?? | form_dropdown selected working but not showing as selected in view to user. (/showthread.php?tid=52672)



DISREGARD / CANT DELETE A POST?? | form_dropdown selected working but not showing as selected in view to user. - El Forum - 06-20-2012

[eluser]uber_n00b[/eluser]
SEEMS TO BE WORKING ALL OF A SUDDEN??? PLEASE DISREGARD OR DELETE POST.

In my view I build a dropdown via:

Code:
<?php
      $selected =  ($this->form_validation->set_value('company')?$this->form_validation->set_value('company'):$company);
      echo form_dropdown('company', $company_drop, $selected);
?>

Which generates the correct <select> with the correct option selected in the html markup it generates.

Code:
<select name="company">
   <option value="">Select Company</option>
   <option selected="selected" value="3">Company 3</option>
   <option value="2">Company 2</option>
   <option value="1">Company 1</option>
</select>

The issue is that even though Company 3 option has the selected="selected" it displays as if nothing is marked as selected so it shows the first option. Since this is for an edit data view I need the user to see what the selected item is.

Please let me know if this is not clear.

Thanks!


DISREGARD / CANT DELETE A POST?? | form_dropdown selected working but not showing as selected in view to user. - El Forum - 06-20-2012

[eluser]Karman de Lange[/eluser]
this normally a browser issue, try ctrl-f5, if that fixes is, then you might have to set headers not to cache the page....


DISREGARD / CANT DELETE A POST?? | form_dropdown selected working but not showing as selected in view to user. - El Forum - 06-20-2012

[eluser]CodeIgniteMe[/eluser]
set no-cache to headers