preline icon indicating copy to clipboard operation
preline copied to clipboard

Disabled attribute added dynamically to advanced selects HSSelect doesn't work

Open sebGH06 opened this issue 7 months ago • 3 comments

Hello,

I am using livewire and livewire add automatically the disabled attribute to input and select element when form is submitted

However, advanced selects are not disabld when the disabled attribute is added dynamically.

It only works when disabled is set before dom update

Could you please explain how to find a workaround? Best

sebGH06 avatar May 04 '25 18:05 sebGH06

@sebGH06 Hi! At the moment, we don't have official documentation for Livewire integration. However, some of our users have shared their own solutions. I believe this one does a good job of explaining how to reinitialize a component during a specific lifecycle event.

olegpix avatar May 05 '25 08:05 olegpix

Does not work in React too, passing disabled attribute by props...

luanfonsecap avatar May 23 '25 14:05 luanfonsecap

@olegpix it doesn't relate to elements being re initialised by livewire for this case

I re explain, with livewire, by default, when a form is submitted, Livewire will automatically disable the submit elements and add the readonly attribute to each input element while the form is being processed.

However, in addition to this default behavior, Livewire offers the .attr modifier to allow you to toggle other attributes on an element or toggle attributes on elements that are outside of forms:

for exemple

<select wire:loading.attr="disabled"><option value="yes">{{__('Oui')}}</option><option value="no">{{__('Non')}}</option></select>

Here when the form is submitted livewire will add dynamically the disabled attribute to select

But when doing this, it doesn't disable your select

Puting the disabled attribute like this will only works when disabled is hard coded manually and not added dynamically

Please allow your select to be disabled even when disabled attribute is added dynamically.

Thanks

sebGH06 avatar May 25 '25 13:05 sebGH06

@sebGH06 Hi! We’ll add default support for tracking changes to the disabled attribute in the upcoming update.
Stay tuned for updates!

olegpix avatar Jul 10 '25 15:07 olegpix

Hey @sebGH06, @luanfonsecap - we've just released v3.2 update which includes disabled option per request. Thanks!

jahaganiev avatar Jul 30 '25 19:07 jahaganiev