how to make a link field when user click on this it will redirect to the link?
or do we use any icon that shows us this is a link ?
9 Replies
But how does this work as a form field? How can you edit the field?
@Patrick Boivin i am just want this as a text not field or icon when user click on this it should show in next tab i am using like this
Select::make('supplier_id')
->label('Supplier')
->options(Supplier::all()->pluck('supplier_name', 'id'))
->required()
->afterStateUpdated(function (Closure $set, $state) {
if ($state !== '') {
$supplier = Supplier::find($state);
if ($supplier) {
$set('Link', $supplier->website);
}
}
})
->searchable()
->reactive()
->columns(2),
TextInput::make('Link')
->hidden(fn (Closure $get) => $get('supplier_id') == '')
->columns(1),
One idea is to use a Placeholder instead of a TextInput:
@Patrick Boivin i am setting vlaue in link field from Select how can i use this value in href="..."
Don't set it in the Select, move this logic inside of
content()
@Ali Abbas How did you get that tabs in form action
can you plz provide me a example
i am using use Filament\Forms\Components\Tabs;
inside a edit form how
@NÕØBÎTÅ Tabs\Tab::make('Supplier')->schema([
Repeater::make(name: 'productSuppliers')
->relationship()
->schema($this->_tabSupplierFields())
->columns(3)
]), // End Supplier tab
protected function mutateFormDataBeforeFill(array $data): array using this in edit page for data to populate
@Patrick Boivin thanks this is working fine by using Placeholder
also another way is TextInput::make('Link')
->url()
->suffixAction(fn (?string $state): Action =>
Action::make('visit')
->icon('heroicon-s-external-link')
->url(
filled($state) ? "{$state}" : null,
shouldOpenInNewTab: true,
),
)
->hidden(fn (Closure $get) => $get('supplier_id') == '')
->columns(1),