Dynamically set ->options() in Radio Input from API
Hi, I am working on a public livewire full page component. In this component I am trying to set radio values based on a function which calls an api with data from the form to retrieve the options
This function sets a public property called $transportOptions. Now I want to use these options inside a Radio input. I start with calling the setTransportOptions() on afterStateUpdated on the fields which need to recall the api.
Then inside of the Radio input i have the following:
This is the setTransportOptions function
Solution:Jump to solution
Figured it out. I made my own plugin for radio inputs. It had the wire:ignore attribute on it for the custom alpine class. I changed it to wire:ignore.self and it worked.
3 Replies
For testing purposes I removed the afterState call and am calling the api via the hint action. The end goal is to use my own RadioCard plugin instead of Radio input. The weird thing is that inside my radioCard plugin it does throw the options. It just does not render the fields.
Does anybody have any clues where the issue lies? Or what other solutions can I try? Thanks in advance!
i have this as a public property. Now my understanding of livewire was that whenever public properties are updated, it also resends the html over the wire.
What would be other options to set the values inside my radioCard plugin?
For testing purposes i also added a get and set function, I would like to set the options of the card based on this action.
When I set the public property to the following, then it does work but these values of course can be dynamic:
I am really lost here so help would be appriciated!
Solution
Figured it out. I made my own plugin for radio inputs. It had the wire:ignore attribute on it for the custom alpine class. I changed it to wire:ignore.self and it worked.