• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Form_Dropdown with Blank "Select One..." Option

#3
[eluser]michalsn[/eluser]
Validation:
Code:
$this->form_validation->set_rules('is_active', 'Is active', 'required');
Static array sample:
Code:
$is_active_dropdown = array(
    NULL => 'Select one...',
    0    => 'No',
    1    => 'Yes'
);
Dynamic array sample:
Code:
$query = $this->db->get('is_active_dropdown');
$data[0] = 'Select one...';
foreach ($query->result_array() as $row)
{
    $data[$row['id']] = $row['name'];
}
return $data;
View:
Code:
<?php echo form_dropdown('is_active', $is_active_dropdown, set_value('is_active')); ?>


Messages In This Thread
Form_Dropdown with Blank "Select One..." Option - by El Forum - 08-07-2012, 03:08 AM
Form_Dropdown with Blank "Select One..." Option - by El Forum - 08-07-2012, 04:19 AM
Form_Dropdown with Blank "Select One..." Option - by El Forum - 08-07-2012, 05:01 AM
Form_Dropdown with Blank "Select One..." Option - by El Forum - 08-07-2012, 05:07 AM
Form_Dropdown with Blank "Select One..." Option - by El Forum - 08-07-2012, 05:11 AM
Form_Dropdown with Blank "Select One..." Option - by El Forum - 08-07-2012, 05:12 AM
Form_Dropdown with Blank "Select One..." Option - by El Forum - 08-07-2012, 05:14 AM
Form_Dropdown with Blank "Select One..." Option - by El Forum - 08-07-2012, 05:27 AM
Form_Dropdown with Blank "Select One..." Option - by El Forum - 08-07-2012, 09:36 PM
Form_Dropdown with Blank "Select One..." Option - by El Forum - 08-08-2012, 03:33 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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