⚠ 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

Problem with the setRelation dropdown.



dhouwen

dhouwen
  • profile picture
  • Member

Posted 04 February 2020 - 12:08 PM

Hi Folks!

 

I have a problem with the setRelation dropdown.
 
I'm using the Enterprise version and i need to have the possibility to save an empty value.
$crud->setRelation('officeCode', 'offices', 'city')

Example:

 

When i'm check this example (non enterprise version) there is an option to choose for an empty value.

https://www.grocerycrud.com/demo/employees_management/bootstrap

 

Whem i'm check the same enterprise example i don't have this empty option.

https://www.grocerycrud.com/enterprise/examples-3/set-database-relation/

 

Does anyone knows how i get this empty value option in the enterprise version?

 

Thanks!

 


Soreno

Soreno
  • profile picture
  • Member

Posted 04 February 2020 - 20:47 PM

Hello, dhouwen.

It depends on settings of your database field. If that field has NOT NULL constraint you will not have empty option in your GC.


dhouwen

dhouwen
  • profile picture
  • Member

Posted 04 February 2020 - 21:39 PM

Hi there,

 

Thanks for your reply. This is my field setting, still no empty function. Any idea?

`test` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL;