⚠ 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

Feature Request : $crud->fixed_fields(...)



fabgonber

fabgonber
  • profile picture
  • Member

Posted 05 November 2012 - 00:35 AM

Hi All,

I need a visible but "not changeable" field in the edit form. The basic idea es simple: the user can edit the data, he see all the values in the edit form, but only can modify some values.

In my opinion this example is would be perfect:


function example_edit_fixed(){
$crud = new grocery_CRUD();
$crud->set_table('city');
$crud->set_relation('country_id','country','country_name');
$crud->columns('country','city','another_field');
$crud->fields('country','city','another_field_1','another_field_2','another_field_3');
$crud->fixed_fields('country','city');
$crud->required_fields('country','city','another_field_1','another_field_2','another_field_3');
$output = $crud->render();
$this->_example_output($output);
}


The basic idea es simple in the html form:


<input type=hidden name=country_id value=49><input type=text value='Germany' disabled>


I try to do this with callback_edit_field but in function edit_field_callback_1($value, $primary_key) the value is the "foreign key". In the example: i can receive "49" but no the "germany"

Sorry for my bad english

Recargs

noskov.biz

noskov.biz
  • profile picture
  • Member

Posted 05 November 2012 - 07:41 AM

Hi, fabgonber and welcome to the forum!
You can easily make this with field_type() function. For example:

$crud->field_type('country', 'readonly');


For more info, please, read the documentation.

Best regards!

fabgonber

fabgonber
  • profile picture
  • Member

Posted 07 November 2012 - 23:14 PM

Thanks a lot !! but... when i do the change... i see the 49, not germany.