Pass 'Select' field values to other fields.
I have a dropdown which displays all my customer addresses. Now I also have a field on my form called RadiusFilter which is basically an address text box. What i want to happend is for the RadiusFilter to be dependent on the SelectFilter (Which contains all the addresses of the customers).
So let's say, I picked address '1' on the Select Filter, address '1' would automatically be inputted on the RadiusFilter textbox.
SelectFilter::make('Customer')
->relationship('customer','cus_address'),
RadiusFilter::make('radius')
->attribute('Customer'),
MapIsFilter::make('map'),
Sorry guys, been trying to find answers on the docs but I can't find anything.
5 Replies
It's the same concept here
->live()
and ->afterStateUpdated()
I don't think it works on the filter tho.
aha, sorry. Did you try to customize the query by injecting the selected filter value?
SelectFilter::make()->query(function (Table $table,$query) {
$table->getFilter('status')->getState();
$query->where('user_id', auth()->user()->id);
})
you can accomplish this by many ways: re read the docs here