submit button

I have a PippoResource.php and the relative create edit and list pages. In PippoResource I have the form which has a text input linked to an action button (Search) and a placeholder which had to be filled by the search by the keyword typed in the text input in the DB. I need to disable the default save button of the form until the user has made a search which has given a good result. How can I do this? In the createPippo I tried
protected function getFormActions(): array
{
return [
$this->getSubmitFormAction()->disabled(),
$this->getCancelFormAction(),
];
}
protected function getFormActions(): array
{
return [
$this->getSubmitFormAction()->disabled(),
$this->getCancelFormAction(),
];
}
but I don't know how to make it not disabled using the result of the search of the other button. My form is something like
Section::make('Cerca libro per titolo')
->description(new HtmlString('xxx'))
->schema([
TextInput::make('titolo')
->prefix('Titolo')
->suffixAction(
Action::make('search')->button()->labeledFrom('md')->label("Cerca")
->icon('heroicon-m-clipboard')
->action(function (Set $set, $state) use($id, &$biblioteca){
//something to populate an array of results from the search key
})

),
Placeholder::make('pippo')->label('')
->content(function (Get $get) use(XXX): HtmlString {
//something like "We have found these results" and in this case the save button must be available o "we have found no match" and the save button must stay disabled
});
Section::make('Cerca libro per titolo')
->description(new HtmlString('xxx'))
->schema([
TextInput::make('titolo')
->prefix('Titolo')
->suffixAction(
Action::make('search')->button()->labeledFrom('md')->label("Cerca")
->icon('heroicon-m-clipboard')
->action(function (Set $set, $state) use($id, &$biblioteca){
//something to populate an array of results from the search key
})

),
Placeholder::make('pippo')->label('')
->content(function (Get $get) use(XXX): HtmlString {
//something like "We have found these results" and in this case the save button must be available o "we have found no match" and the save button must stay disabled
});
. Thank you for you answers Bea
0 Replies
No replies yetBe the first to reply to this messageJoin