Closed rahman-nero closed 6 months ago
While writing this issue, I found more elegant way to fix that....
We just have to call disable(), two times:
crud.field('tags').disable();
crud.field('tags[]').disable();
First call will delete from formData (the field won't be sent in request). Second call will disable from HTML view (it will disable field so that it can't be used).
Well I hope u fix it in future. Make it just one call
Thanks for your report @rahman-nero
Indeed some fields require special treatment to properly "disable", "enable" etc. For example: https://github.com/Laravel-Backpack/CRUD/blob/87be4529a445513b04ba8256eec978e94c50e244/src/resources/views/crud/fields/summernote.blade.php#L60
I will investigate this further and get back with the results.
Cheers
Thanks again @rahman-nero
I've just released backpack/pro 2.1.12 with the fix in this field and similar select2 multiples that had the same issue. 👍
It should take a little bit for our private repository to pick the changes, and you should then be able do a composer update
and get the fix.
Let me know if you are still experiencing the issue after the upgrade.
Remember to clear the cache, and make sure you are not overwriting the files in your resources/
folder. 🙏
Cheers
Bug report
What I did
I have a list of fields that has to be disabled. I pass them to js and run
crud.field('field').disable()
, but it doesn't work properly. I have to mention, it works perfectly fine for usual fields, but not for multiselect fields.So, I have a field that called
tags
with multiselect attribute. When I disable the field, It disables but in the end it will appear in request astags => null
What I expected to happen
I expected the field wouldn't be sent
What I've already tried to fix it
I fixed it by simple cleaning formData before submitting the form. Here is code:
More details
CrudController:
Model.php, relationshiop:
JS code that I run:
I expect that tags field will not be in request, but got this:
Backpack, Laravel, PHP, DB version
When I run
php artisan backpack:version
the output is: