⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Show selected value using field_type 'dropdown'



vaibhav

vaibhav
  • profile picture
  • Member

Posted 15 November 2012 - 06:50 AM


$crud->field_type('designation','dropdown',
array('1' => 'PHP Developer', '2' => 'Android Developer','3' => 'Web Designer');


I want to show the selected desigation from the table in the dropdown.
i.e
if($value == 'PHP Developer')
then 'selected="selected"';
in the drop down.

Also if i dont select any designation from the drop down , then the designation value is automatically set to null or empty.


Thanks :)

victor

victor
  • profile picture
  • Member

Posted 02 December 2012 - 00:08 AM

You can use the callback_add_field and callback_edit_field.