Disabled attribute added dynamically to advanced selects HSSelect doesn't work
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 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.
Does not work in React too, passing disabled attribute by props...
@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 Hi!
We’ll add default support for tracking changes to the disabled attribute in the upcoming update.
Stay tuned for updates!
Hey @sebGH06, @luanfonsecap - we've just released v3.2 update which includes disabled option per request. Thanks!