⚠ 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

callback_add_field() and set_relation() with dropdown



kdm
  • profile picture
  • Member

Posted 23 January 2013 - 11:45 AM

hi all,

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..,

zrmba
  • profile picture
  • Member

Posted 02 February 2013 - 22:17 PM

Don't get well waht you are explainaing but if you ahve something like this:

$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?

techTD
  • profile picture
  • Member

Posted 17 July 2017 - 10:51 AM

..