Best way to fill hint action data from component it is hinting from
Sorry if that doesn't really make sense but in the below code, I have a text box and a hint action on there,
I need to be able to get the value of the text box to populate the options of the radio field in the action slideover, i have tried before form filled where i can get the value of connection but returning $data['directories'] as an array so ['test'=>'test'] does not fill this, when i do the options i need to be able to get this from the connection information.
https://gist.github.com/sabuto/6d4ec88e7f1315ea1a12865357dc59b2
15 Replies
you can get all the values via $get .. but if you want that the radio options are updated when you change the select .. then you have set ->live() to the select .. otherwise it renders too late
I tried to use $get see on line 22, i also tried just $get('connection') but it says connection is not found i think because it is a different form?
yeah .. didn't see there's another form .. but why you're using a differnt form there ?
so i have the main form, which is the connection etc i then want a folder picker on the ftp server so this action is the folder picker where it connects to the server and lists folders i will then use the selected folder as the value in the field
u could use events to communicate between them
but also handle everything in 1 component
how would i do this with events?
i tested
i don't think it's the right way .. but it works
Radio::make('directories')->options(function ($livewire) {
dd($livewire->data['connection']);
})
This works, however because the data is from a repeater it has the id which is randomly generated, so i need to figure out a way to grab that somehow, thank you for your help so far π
If i do beforeFormFilled on Action and do $get('connection;) it pulls it but i am unsure how to pass this along to the Action form I have tried injecting $data and assigning $data['connection'] to the value and then in the form of the form of the action passing $data but that can't resolve and then $get put that doesnt pull from the data
i think you don't have to pass it .. just access livewire in your action
it should all be in the same state
so this is my problem, i need a way of grabbing it from the repeater
where as if i do it here it grabs the right value
so one of these tasks is upload to ftp und you want to check the connection for this? .. and the other tasks are differnt ?
i do not really understand your concept
yes so i have tasks like this, I want to test the connection of the last repeater item in the image, the hint action is the code from the gist
I hope this makes sense
and if you click on test connection the directories should appear ?
how about s.th like this
I could work with this thank you, it would mean i wouldn't need the hint action at all I don't think