May i know how can i set default value for hidden fields since i am using fieldType('fieldname','hidden','my default value') but its not working value is not update which i pass as third parameter to this function. I am using the latest version of Grocery Crud enterprise Grocery CRUD Enterprise v2.7.9
Hello @
You should use the function: callbackEditForm (https://www.grocerycrud.com/enterprise/api-and-function-list/callbackEditForm/) in order to achieve that. More specifically in your case you will do something like this:
$defaultValues = function ($data) {
$data['fieldname'] = 'my default value';
return $data;
};
$crud->fieldType('fieldname','hidden','my default value');
$crud->callbackAddForm($defaultValues);
$crud->callbackEditForm($defaultValues);
Let me know if that worked for you
Regards
Johnny