Jump to content


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


  • Please log in to reply
2 replies to this topic

#1 larasmith

larasmith

    Advanced Member

  • Members
  • PipPipPip
  • 191 posts
  • LocationPhilippines

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

 

 

 



#2 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,101 posts
  • LocationLondon

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


Posted Image

#3 larasmith

larasmith

    Advanced Member

  • Members
  • PipPipPip
  • 191 posts
  • LocationPhilippines

Posted 18 September 2019 - 02:26 AM

Hello Johnny!

 

This works! Sorry for the late feedback! 

 

:)






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users