How to change the suffix value of a component after select component setted
I want to change the suffix value of the component when the platform is selected. how can I do this?
Solution:Jump to solution
@Zeynal also please read: https://discord.com/channels/883083792112300104/1167015843020943390
11 Replies
You can use
afterStateUpdated
and reactive
https://filamentphp.com/docs/3.x/forms/advanced#field-updatesI have read this page many times. how can I access the suffix property of the other component in the afterStateUpdated method?
Form/Get
in your callback/closure function parameter
function (Form/Get $get) {
dd($get('field_name');
}
Yes, I try this but it only returns me the value of the component. for example 1,2,3
Please share your code
You need to think the other way around. You don't set a method from
->afterStateUpdated()
. That method can return a different value based on another field thought.
So instead of ->afterStateUpdated()
you use
It's better to share your code, now it's clear that
afterStateUpdated
is not the right way to resolve your issueSolution
@Zeynal also please read: https://discord.com/channels/883083792112300104/1167015843020943390
I really didn't expect it to work like this. It's really great. Thank you so much for saving my day.
@Dennis Koch So is there an easier way of this code?
Platform::find($get('platform_id'))->name;
I mean, can I get it from the component instead of getting it from the database?