⚠ 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

Field type Hidden Not working in Grocery CRUD Enterprise v.2.7.4



larasmith

larasmith
  • profile picture
  • Member

Posted 10 June 2019 - 03:11 AM

Hi Everyone!

 

I would like to ask if you experience using fieldtype hidden and notice if it is functioning or not? See my sample below:

 

$crud->fieldType('fld_Name','hidden');

 

That API supposedly hides the specified field but now it does nothing in GroceryCRUD Enterprise v.2.7.4 

 

Thanks in advance!

 

-Lara

 

 

 


web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 11 June 2019 - 11:10 AM

Hi Everyone!

 

I would like to ask if you experience using fieldtype hidden and notice if it is functioning or not? See my sample below:

 

$crud->fieldType('fld_Name','hidden');

 

That API supposedly hides the specified field but now it does nothing in GroceryCRUD Enterprise v.2.7.4 

 

Thanks in advance!

 

-Lara

 

 

Hello Lara

It seems that the hidden field type is working but it is a bit different than the way that it works on community edition. More specifically it is good to combine it with callbackEditForm and callbackAddForm . For example if you have let's say the below code:
 

$crud->fieldType('category_id', 'hidden');

it will just hide the category_id on the add, edit, clone form.... e.t.c. however if you would like to add a value to this example you should do something like this:
 

$crud->callbackAddForm(function ($data) {
    $data['category_id'] = $_SESSION['category_id'];

    return $data;
});
$crud->callbackEditForm(function ($data) {
    $data['category_id'] = $_SESSION['category_id'];

    return $data;
});

I've tested that the above works fine for version 2.7.5 and for version 2.7.4 (just to confirm that it is not a version issue).

 

Can you please re-check and let me know if you are still having issues? What are you trying to do exactly? The most common mistake is when we have accidentally two types into the same field. For example the field is using setRelation AND is also hidden. Or for example you have a callbackEditField and is also hidden. Again this is something that it has two types (e.g. callback_field and hidden).

 

If this is the case this is a common issue that to be honest I am not sure yet the approach in order to solve that.

 

In any case if you let me know your exact problem maybe I can guide you to a better solution.

 

Regards

Johnny


larasmith

larasmith
  • profile picture
  • Member

Posted 18 September 2019 - 02:26 AM

Hello Johnny!

 

This works! Sorry for the late feedback! 

 

:)