callback_add_field() and set_relation() with dropdown
- Single Page
Posted 23 January 2013 - 11:45 AM
i have state field in table. In add page,i want to show all state name from states table. it is done with set_relation().
now i want to give one checkbox and text box below that dropdown so i used callback_add_field() but in callback funciton i can not get those state names.
how can i display dropdown with state names and its below checkbox and textbox.
please reply..,
Posted 02 February 2013 - 22:17 PM
$crud->callback_field('type',array($this,'typefacture'));
Then you can write your callback with parameter like this:
function typefacture($value = '', $primary_key = null)
{
$state = $state1 = $state2 = '';
if ($value== 'transport') $state1='selected' ;elseif ($value== 'transit')$state2='selected'; else $state = 'selected';
return ' <select name="type">
<option '. $state .' value="">Type de facture</option>
<option '. $state2 .' value="transit">Transit</option>
<option '. $state1 .' value="transport">Transport</option>
</select> ';
}
So haw can't you get the value you need?
Posted 17 July 2017 - 10:51 AM
..