sorry for my english.
I use this function => unset_edit_fields
but that field it also disappear on read page too.
how to unset a field on edit form page but still show in read page.
thank you. :)
⚠ 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. ⚠
Posted 03 September 2013 - 09:39 AM
sorry for my english.
I use this function => unset_edit_fields
but that field it also disappear on read page too.
how to unset a field on edit form page but still show in read page.
thank you. :)
Posted 03 September 2013 - 11:16 AM
sorry for my english.
I use this function => unset_edit_fields
but that field it also disappear on read page too.
how to unset a field on edit form page but still show in read page.
thank you. :)
You can Add this field into $crud->columns('field_name');
Posted 03 September 2013 - 14:19 PM
You can Add this field into $crud->columns('field_name');
Thankyou for your answer but I think that will also show in index page too.
I want that field only show on read page and not show on edit page.
Thankyou
Posted 03 September 2013 - 17:32 PM
hello sinnawat
$crud->columns(); shows columns when we render list.
$crud->field(); field shown in add and edit.
can you show your code..?
Posted 04 September 2013 - 02:52 AM
hello sinnawat
$crud->columns(); shows columns when we render list.
$crud->field(); field shown in add and edit.
can you show your code..?
I mean unset edit field but not in unset in read page (example => user/index/read/9)
Posted 04 September 2013 - 03:48 AM
Hello [member=sinnawat vorasitthipat].
Well I must admit there is something strange there.
When using unset_edit the fields on add or the columns on read shouldn't be affected!
Can you please tell us which version of this library you use and also post your controller's function?
Posted 04 September 2013 - 03:57 AM
Hello [member=sinnawat vorasitthipat].
Well I must admit there is something strange there.
When using unset_edit the fields on add or the columns on read shouldn't be affected!
Can you please tell us which version of this library you use and also post your controller's function?
Library Version 1.4.1
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class User extends Admin_Controller { public function __construct() { parent::__construct(); $this->load->library('grocery_CRUD'); } public function index() { $crud = new grocery_CRUD(); $crud->set_table('user'); $crud->columns('user_id','show_name', 'first_name', 'last_name', 'email', 'is_admin', 'datetime_create'); $crud->where('status', 1); $crud->order_by('user_id', 'desc'); $crud->unset_edit_fields('status', 'notification_amount', 'password'); $crud->field_type('gender','dropdown', array('m' => 'Male', 'f' => 'Female')); $crud->field_type('is_seller','dropdown', array('y' => 'Yes', 'n' => 'No')); $crud->field_type('is_buyer','dropdown', array('y' => 'Yes', 'n' => 'No')); $crud->field_type('active_account_status','dropdown', array('y' => 'Yes', 'n' => 'No')); $crud->field_type('subscribe_news_status','dropdown', array('y' => 'Yes', 'n' => 'No')); $output = $crud->render(); $data['output'] = $output; $this->layouts->view('user', $data); } } /* End of file admin.php */ /* Location: ./application/controllers/admin/user.php */
Posted 04 September 2013 - 08:12 AM
First of all please move your Grocery CRUD code elsewhere from the index function. It is documented that this can have unexpected behaviour.
Also I have researched your issue with the fields disappearing from the read page.
The read feature has been included to the latest version only at the last minute and it might contain such mishandling.
I have posted this as an issue here.
Sorry for this, you need to be a little patient.
Thanks.
Posted 04 September 2013 - 08:43 AM
First of all please move your Grocery CRUD code elsewhere from the index function. It is documented that this can have unexpected behaviour.
Also I have researched your issue with the fields disappearing from the read page.
The read feature has been included to the latest version only at the last minute and it might contain such mishandling.
I have posted this as an issue here.
Sorry for this, you need to be a little patient.
Thanks.
OK Thankyou.
Now I use this instead
if($state == "edit") { $crud->unset_fields('status', 'notification_amount', 'password'); }
It's work.
Posted 30 March 2017 - 00:25 AM
Posted 30 March 2017 - 07:09 AM
I would like make fields that would be read only instead of$crud->unset_field('nameoffield');
$crud->field_type('nameoffield', 'readonly')