⚠ 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

Relation field should not appear in edit & add, only list & read. How to do?



Cleiton Garcia

Cleiton Garcia
  • profile picture
  • Member

Posted 15 January 2014 - 12:35 PM

Hello to all,
 
I'm having trouble performing the following ... to add or edit (int) $ user_id field is not displayed. However, in columns and read the record, the name appears (relation) of the same.
 
Sorry if this question already exists, but sought and found.

 

Thanks

 

--

 

Method 'systems':

public function systems()
	{
		try{
			$crud = new grocery_CRUD();

			$crud->set_table('systems')
				->set_subject('Sistema')
				->columns('name', 'platform', 'responsible', 'language')
				->fields('name', 'user_id', 'description', 'platform', 'responsible', 'language', 'status', 'modified')
				->field_type('modified', 'datetime')
				//->field_type('user_id', 'hidden', $this->auth_verify['id'])
				->display_as('name', 'Nome do Sistema')
				->display_as('description', 'Descrição')
				->display_as('platform', 'Plataforma')
				->display_as('responsible', 'Responsável')
				->display_as('language', 'Linguagem')
				->display_as('user_id', 'Editor')
				->display_as('modified', 'Data');


			$crud->set_relation('user_id','users','name');

			$output = $crud->render();
			$this->_example_output($output);

		}catch(Exception $e){
			show_error($e->getMessage().' --- '.$e->getTraceAsString());
		}
	}