Where is the problem....
I got:
$crud->set_relation('idtrafonet','trafonet','serial',array("used" => "0"));
works ok to assign the "trafonet" id available (value 0), but when the form is saved, a callback set the 0 to 1, so it used.
here is the problem... when comes to "EDIT" the field comes in blank because is not set to 0 anymore is set to 1. So my question is
how can I show that field setted to 1 in the edit form?
Thanks in advance.
set_relation and fourth param
Started by jcasanova, 08 June 2012 - 20:14 PM
- Single Page
Posted 08 June 2012 - 20:14 PM
Posted 08 June 2012 - 20:38 PM
I did this.
$crud->callback_edit_field('idtrafonet',array($this,'edit_field_callback_idtrafonet'));
function edit_field_callback_idtrafonet($value, $primary_key){
//$valor_orig = $this->M_trafonet->trae_valor_original_idtrafonet($primary_key);
$result = '<select name="idtrafonet">';
$result .= '<option value=""></option>';
$result .= '<option value="1">'.$primary_key.'</option>';
$result .= '<option value="2">2</option>';
$result .= '</select>';
return $result;
}
is there other *better* way? or just this way?
$crud->callback_edit_field('idtrafonet',array($this,'edit_field_callback_idtrafonet'));
function edit_field_callback_idtrafonet($value, $primary_key){
//$valor_orig = $this->M_trafonet->trae_valor_original_idtrafonet($primary_key);
$result = '<select name="idtrafonet">';
$result .= '<option value=""></option>';
$result .= '<option value="1">'.$primary_key.'</option>';
$result .= '<option value="2">2</option>';
$result .= '</select>';
return $result;
}
is there other *better* way? or just this way?