It looks like you're new here. If you want to get involved, click one of these buttons!
For above code, $id is id for mySql table and $values is loaded with :
function edit($id = NULL){
$this->load->library('form_builder');
$vars['instructions'] = 'Here instructions';
$values = (array)$this->messages_model->get_message($id)[0];
$fields = $this->messages_model->form_fields($values);
$this->form_builder->load_custom_fields(APPPATH.'config/custom_fields.php');
$this->form_builder->submit_value = lang('btn_upload');
$this->form_builder->set_fields($fields);
$vars['form'] = $this->form_builder->render();
$this->fuel->admin->render('_blocks/module_create_edit', $vars, '', MESSAGES_FOLDER);
}
In model:
Array
(
[id] => 1
[date_added] => 2016-09-25
[last_modified] => 2016-09-26 19:12:52
[title_message] => titulo mensaje
[body_message] => El mensaje que se desea enviar
[file] =>
[all_operators] => 0
[operators_list] => ["4","15","1","2","7","9","16","17"]
[deleted] => 0
)
Array $fields returned with no values:
function form_fields($values = array()){
$fields = parent::form_fields($values);
return $fields;
}
ArrayWhat is your advise for above code? I'm forget something ?
(
[id] => Array
(
[name] => id
[type] => int
[default] =>
[options] =>
[max_length] => 10
[primary_key] => 1
[comment] =>
[collation] =>
[extra] => auto_increment
[null] =>
[required] =>
)
[date_added] => Array
(
[name] => date_added
[type] => hidden
[default] =>
[options] =>
[max_length] =>
[primary_key] =>
[comment] =>
[collation] =>
[extra] =>
[null] => 1
[required] =>
)
[last_modified] => Array
(
[name] => last_modified
[type] => hidden
[default] => CURRENT_TIMESTAMP
[options] =>
[max_length] =>
[primary_key] =>
[comment] =>
[collation] =>
[extra] =>
[null] => 1
[required] =>
)
[title_message] => Array
(
[name] => title_message
[type] => string
[default] =>
[options] =>
[max_length] => 100
[primary_key] =>
[comment] =>
[collation] => latin1_swedish_ci
[extra] =>
[null] => 1
[required] => 1
)
...
...
Comments
$this->form_builder->set_field_values($values);
1. How can I set attrs into form tag, I tried with: But it doesn't work.
2. When send javascript from controller to view, It seems no be rendered, or not printed
In controller: In view:
2. How are you passing the $vars to the view?
$this->form_builder->use_form_tag = FALSE;