⚠ 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

hide input but insert a value in DB?



chocovo
  • profile picture
  • Member

Posted 24 November 2014 - 11:59 AM

Hello,

 

I am new with CodeIgniter and Grocery CRUD and I am doing my first project.

 

My problem is this:

 

When somebody add a new entry I would like to hide 'tecnician' input and update DB with a default value.

 

Tecnician will be a select option only visible and editable in edit option.

 

$crud->add_fields('date', 'type', 'title', 'description', 'state');
$crud->edit_fields('date', 'type', 'title', 'description', 'state', 'tecnician');

 

Some idea about it?

 

Thank you

 

 


Amit Shah
  • profile picture
  • Member

Posted 24 November 2014 - 14:57 PM

GC have a method - getState ...

if the state == 'add'

   just set field type technician to be hidden

 

that way it will be available as a field and also hidden in case the state is add


chocovo
  • profile picture
  • Member

Posted 26 November 2014 - 08:45 AM

It is cristal clear... Thank you