• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how does form_dropdown() magically repopulate my dropdown ?


I am an almost complete CI newbie (but completely loves the framework anyway!)

I don't understand how my dropdown is (magically) repopulated on submit (by post value) as I don't provide any default value or set_value rule.

Here is my code :

view :
echo form_dropdown('marque', $options_marque, $options_marque_selected);

controller :
$data['options_marque'] = $this->load->model('global/marque_model')->get_options();
$data['options_marque_selected'] = array();

If I run form_validation on submit with an error, my dropdown is repopulated with the value I chose even if I don't provide any set_value or set_select instruction !

Where is the magic ?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.