[Clarification] jQuery to manipulate radiobuttons no longer supported
See original GitHub issueBug report
Upgraded a project from 4.0 to Backpack 4.1 that uses jQuery to manipulate radiobuttons on a certain form. Backpack seems to no longer support the manipulation of radiobuttons (and maybe others?) through jQuery as they cannot be referenced anymore.
What I expected to happen
Since the jQuery is very simple I expected it to still work as before
if (data.accounttype==1) {
$("#account_type_id_1").prop("checked", true);
} else {
$("#account_type_id_2").prop("checked", true);
};
But it doesn’t work this way anymore.
What happened
I believe that since commit https://github.com/Laravel-Backpack/CRUD/commit/432c7ad624f17a4f4ef39b16adb16062ebcf972f#diff-a2efdb166bd02ef6c483c84a018ba61da52a4f1eb04985589d695c37a266bda7 where it was facilitated to have radiobuttons in repeatables there is a hidden input being added to the code and the name properties from the radiobutton input were removed.
What I’ve already tried to fix it
There are some alternative ways to reference the actual radiobutton, but since there is a randomised ID and there is no longer a name property for the radiobutton (it got taken over by the hidden field) I believe there is no longer a way to this. So something like this doesn’t work either
$("input[name=account_type_id][value='1']").prop("checked",true);
Backpack, Laravel, PHP, DB version
When I run php artisan backpack:version
the output is:
PHP VERSION:
PHP 7.4.4 (cli) (built: Mar 20 2020 13:47:45) ( NTS ) Copyright © The PHP Group Zend Engine v3.4.0, Copyright © Zend Technologies with Zend OPcache v7.4.4, Copyright ©, by Zend Technologies
LARAVEL VERSION:
v8.15.0@22e4182fa0885dea3772106c3b6df705b7c7363e
BACKPACK VERSION:
4.1.27@bd1bab5dde08df20eebd730ca3a2992e1bf334f7
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
Haha definitely. If you didn’t know about this, I use this package to make VAT-work a little easier in Laravel: https://github.com/dannyvankooten/laravel-vat . Maybe it helps you too.
no problem! Just for clarification: the VIES lookup field is the custom one, the radiobuttons are still the default ones. But you’re right that VIES lookup fields will only work in certain conditions, don’t have the ambition to make into a repeatable field, they don’t deserve it. If VIES would have their repo over here, I think GitHub would explode 😂