lock filds to edit
- Single Page
Posted 10 June 2012 - 09:50 AM
i want lock a flid for edit but show it in edit page
for example i have 'username' 'password' and id filds and only i want edit password but user name and id show on edit page
what can i do for this?
Posted 10 June 2012 - 10:16 AM
You can easily use function change_field_type, for example:
$crud->change_field_type('username', 'readonly');
Posted 10 June 2012 - 11:12 AM
Posted 10 June 2012 - 14:00 PM
if i want add new item its loked
i want only in edit its locked
Posted 10 June 2012 - 14:42 PM
function users_example($operation = null) {
$crud = new grocery_CRUD();
$crud->set_table('users');
if($operation == 'edit')
{
$crud->change_field_type('username', 'readonly');
}
$output = $crud->render();
$this->_example_output($output);
}
Posted 10 June 2012 - 14:42 PM
$crud->callback_edit_field('username', array($this, 'readonly_edit_field'));
and then add [b]readonly_edit_field[/b] function:
public function readonly_edit_field($value = '', $key = null)
{
return '<div style="margin:6px 0 0">'.$value.'</div>';
}
Please, read the documentation of API grocery_crud You can find there a lot of helpful things.