question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Clarification] jQuery to manipulate radiobuttons no longer supported

See original GitHub issue

Bug 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:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
tabacitucommented, Dec 9, 2020

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.

0reactions
timbertenscommented, Dec 9, 2020

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 😂

Read more comments on GitHub >

github_iconTop Results From Across the Web

get radio button value on change not working - Stack Overflow
I use this code for get the value of radio button in jquery, my problem is when I click the option 1 it...
Read more >
How to select a radio button with jQuery - Mkyong.com
A simple example to select a radio button with jQuery dynamically. A radio buttons group, with a name=”sex”. <input type="radio" name="sex" ...
Read more >
JavaScript - Bootstrap
Consult our bower.json to see which versions of jQuery are supported. Data attributes. You can use all Bootstrap plugins purely through the markup...
Read more >
javascript/jQuery plugin for formatting radio buttons and checkboxes ...
I'm looking for a javascript/jQuery plugin for custom formatting of form radio ... grid system which is responsive, with three main screen sizes...
Read more >
How to disable or enable buttons using Javascript and jQuery
Code Explanation. 1. Now, using javascript we store a reference to each element, namely input, and button. 2. By default a button's state ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found