F
Filamentπ•Ύπ–†π–ˆπ–—π–Šπ–’π–Šπ–“π–™π–šπ–˜

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
Gist
Test.php
Test.php. GitHub Gist: instantly share code, notes, and snippets.
M
mvenghausβ€’43d ago
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
π•Ύπ–†π–ˆπ–—π–Šπ–’π–Šπ–“π–™π–šπ–˜β€’42d ago
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?
M
mvenghausβ€’42d ago
yeah .. didn't see there's another form .. but why you're using a differnt form there ?
π•Ύπ–†π–ˆπ–—π–Šπ–’π–Šπ–“π–™π–šπ–˜β€’42d ago
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
M
mvenghausβ€’42d ago
u could use events to communicate between them but also handle everything in 1 component
π•Ύπ–†π–ˆπ–—π–Šπ–’π–Šπ–“π–™π–šπ–˜β€’42d ago
how would i do this with events?
M
mvenghausβ€’42d ago
i tested i don't think it's the right way .. but it works Radio::make('directories')->options(function ($livewire) { dd($livewire->data['connection']); })
π•Ύπ–†π–ˆπ–—π–Šπ–’π–Šπ–“π–™π–šπ–˜β€’40d ago
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
M
mvenghausβ€’40d ago
i think you don't have to pass it .. just access livewire in your action it should all be in the same state
π•Ύπ–†π–ˆπ–—π–Šπ–’π–Šπ–“π–™π–šπ–˜β€’40d ago
so this is my problem, i need a way of grabbing it from the repeater
No description
π•Ύπ–†π–ˆπ–—π–Šπ–’π–Šπ–“π–™π–šπ–˜β€’40d ago
where as if i do it here it grabs the right value
No description
M
mvenghausβ€’40d ago
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
π•Ύπ–†π–ˆπ–—π–Šπ–’π–Šπ–“π–™π–šπ–˜β€’40d ago
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
No description
M
mvenghausβ€’40d ago
and if you click on test connection the directories should appear ? how about s.th like this
Forms\Components\Repeater::make('task')
->schema([
Forms\Components\Select::make('connection')
->options([1 => 'one', 2 => 'two'])
->default(2)
->live(),
Forms\Components\TextInput::make('location')
->hintAction(
Action::make('test')
->action(function(Get $get) {
dd($get('connection'));
})
),
Forms\Components\Fieldset::make('directories')
->schema(function(Get $get) {

$options = [];
if ((int)$get('connection') === 2) {
$options[] = 'foo';
}

return [
Forms\Components\Radio::make('selection')
->options($options)
];
})
->visible(fn(Get $get) => (int)$get('connection') === 2)

]),
Forms\Components\Repeater::make('task')
->schema([
Forms\Components\Select::make('connection')
->options([1 => 'one', 2 => 'two'])
->default(2)
->live(),
Forms\Components\TextInput::make('location')
->hintAction(
Action::make('test')
->action(function(Get $get) {
dd($get('connection'));
})
),
Forms\Components\Fieldset::make('directories')
->schema(function(Get $get) {

$options = [];
if ((int)$get('connection') === 2) {
$options[] = 'foo';
}

return [
Forms\Components\Radio::make('selection')
->options($options)
];
})
->visible(fn(Get $get) => (int)$get('connection') === 2)

]),
π•Ύπ–†π–ˆπ–—π–Šπ–’π–Šπ–“π–™π–šπ–˜β€’39d ago
I could work with this thank you, it would mean i wouldn't need the hint action at all I don't think
Want results from more Discord servers?
Add your server
More Posts
Disable tenancyHello, I am using Filament to convert an existing app into a multi tenant. Tenancy works great. WondHow to hide a field in a 2 column layout and keep the space reservedI have a 2 column layout in a form. Field 1 determines whether field 2 is hidden or not. If it is huse record id in fileAttachmentsDirectoryhello, i have this code ```php RichEditor::make('content')->fileAttachmentsDirectory('posts')->columIs there an easy way to store a section into a json fieldI'm currently using a repeater but trying to simplify since I'm running into memory issuesWhat query to select from date now and see between 2 columnWhat query to select from date now and see between 2 column, like i want to check is today still morClosure Upload Folder dynamicHow to use dynamic id based on select? Case: upload multiple pictures to one gallery. PS: i need saCan we modify the dd tag that contains custom infolist entries?Hello all, I was working on creating a custom infolist entry for my app (basically a scrollable `prSubfroms /sections with individual actionsI am structuring my complex form using sections and I would like to do separate updates, section by translate badge columnHow can I translate a badge Column in Filament3?Conditionally show relation managerMy items model, if a condition is met, will be able to have users or not. This condition can be calExport Button has no export option on a custom table in livewireI created a custom export table and added an export action but it seems I cannot exportHow to specify ignoreRecord in unique rule in Import?I've added an import action to a model with option to update existing record via `firstOrNew` methodSelect Field Component State: Injecting Title along with IDHey all, Wondering if this is possible at all without formatting the state with ->formatStateUsing(Filament Fabricator dynamic route challengeHow to create #filament-fabricator pages with dynamic routes like list pages, search pages where youImportPolicyI wish to authorize imports of models based on model specific permissions. How can I control it usindispatch livewire event after action executionis there a way to dispatch a livewire event after creation of a record using the CreateAction or anHow to validate repeater items certain conditions before create - Attributes IN repeater itemsHello. Not possible with observer or with mutateFormDataBeforeCreate I have a form to create dossiSenior Full-Stack Developer is here.Hi, Everyone. Full-Stack Web Developer & designer is looking for job. If you are planning any Web Show table action only when a specific filter is setI would like to display a table action, but only when a specific filter is selected. This works on Redirect on a dynamic url after login in a panelI have an app panel and i want to redirect a user on a dynamic url like : /app/institution_id/user_