⚠ 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

How set for one more field in different states?



Paul Savostin
  • profile picture
  • Member

Posted 19 October 2015 - 23:30 PM

I have very simple question here.

Imagine - we have table where we need to register users

Fields in table for example username, email, password

So how I could set in "add" state all three fields and in edit state only 2 fields - email and username?

I understand that we can check state somelike down bellow

 

if($state == 'add')
{
   $crud->fields('username','email','password');
}
else
{
   $crud->fields('username','email');
}

But just imagine if we have 20 fields and different only with one field!?!?

Thanks!


buoncri
  • profile picture
  • Member

Posted 20 October 2015 - 11:47 AM

If i understand, you can use hidden type of the field_type method

 

http://www.grocerycrud.com/documentation/options_functions/field_type

 

Cheers


Paul Savostin
  • profile picture
  • Member

Posted 21 October 2015 - 10:14 AM

If i understand, you can use hidden type of the field_type method

 

http://www.grocerycrud.com/documentation/options_functions/field_type

 

Cheers

Hi! Hidden fields for setting defaults values for some fields that you dont need allow user to change. My situation is different:)