No hint path defined for [forms]
Hey!
I am getting the following error when I navigate from a resource to its creation page.
Any idea why?
No hint path defined for [forms]
No hint path defined for [forms]
16 Replies
Please provide your Schema for the form.
Sure. The below is the entire form that I am returning.
public static function form(Form $form): Form
{
if (ProductVariant::count() === 0) {
return $form
->disabled()
->schema([
Card::make()
->schema([
Placeholder::make('')
->content('No product variants found.'),
])
->columnSpan(1),
]);
}
return $form
->schema([
Section::make('Order')
->schema([
Grid::make(2)
->schema([
Select::make('tenant_id')
->label('Tenant')
->options(Tenant::all()->pluck('name', 'id'))
->preload()
->searchable()
->required(),
Select::make('channel_id')
->label('Sales Channel')
->options(Channel::all()->pluck('name', 'id'))
->default(function (Select $component) {
$options = $component->getOptions();
if (count($component->getOptions()) === 1) {
return array_key_first($options);
}
return null;
}),
Select::make('currency_id')
->label('Currency')
->options(Currency::all()->pluck('name', 'id'))
->default(function (Select $component) {
$options = $component->getOptions();
if (count($component->getOptions()) === 1) {
return array_key_first($options);
}
return null;
}),
TextInput::make('customer_reference')
->label('Customer Reference (optional)'),
]),
]),
CommerceAddressForm::make('billing_address')
->columnSpan('full'),
Section::make('Order lines')
->schema([
Radio::make('source')
->label('Define order lines using:')
->reactive()
->options([
'order_lines' => 'Order lines',
'public_event' => 'Public course',
])
->descriptions([
'order_lines' => 'Select each product variant individually',
'public_event' => 'Fetch product variant linked to the public course',
])
->default('order_lines'),
OrderLineForm::make('')
->hidden(function (Get $get) {
return $get('source') !== 'order_lines';
})
->columnSpan('full'),
OrderLineFromPublicEventForm::make('')
->hidden(function (Get $get) {
return $get('source') !== 'public_event';
})
->columnSpan('full'),
]),
]);
}
public static function form(Form $form): Form
{
if (ProductVariant::count() === 0) {
return $form
->disabled()
->schema([
Card::make()
->schema([
Placeholder::make('')
->content('No product variants found.'),
])
->columnSpan(1),
]);
}
return $form
->schema([
Section::make('Order')
->schema([
Grid::make(2)
->schema([
Select::make('tenant_id')
->label('Tenant')
->options(Tenant::all()->pluck('name', 'id'))
->preload()
->searchable()
->required(),
Select::make('channel_id')
->label('Sales Channel')
->options(Channel::all()->pluck('name', 'id'))
->default(function (Select $component) {
$options = $component->getOptions();
if (count($component->getOptions()) === 1) {
return array_key_first($options);
}
return null;
}),
Select::make('currency_id')
->label('Currency')
->options(Currency::all()->pluck('name', 'id'))
->default(function (Select $component) {
$options = $component->getOptions();
if (count($component->getOptions()) === 1) {
return array_key_first($options);
}
return null;
}),
TextInput::make('customer_reference')
->label('Customer Reference (optional)'),
]),
]),
CommerceAddressForm::make('billing_address')
->columnSpan('full'),
Section::make('Order lines')
->schema([
Radio::make('source')
->label('Define order lines using:')
->reactive()
->options([
'order_lines' => 'Order lines',
'public_event' => 'Public course',
])
->descriptions([
'order_lines' => 'Select each product variant individually',
'public_event' => 'Fetch product variant linked to the public course',
])
->default('order_lines'),
OrderLineForm::make('')
->hidden(function (Get $get) {
return $get('source') !== 'order_lines';
})
->columnSpan('full'),
OrderLineFromPublicEventForm::make('')
->hidden(function (Get $get) {
return $get('source') !== 'public_event';
})
->columnSpan('full'),
]),
]);
}
Try
artisan filament:upgrade
. Do you have any published views of Filament? Also Please give your Placeholder a unique name. Empty strings will cause issues.Yeah, I'll modify the placeholders. Thanks and What do you mean by published views of filament?
Are there files in
resources/views/vendor/filament
and if yes which files are there?Just the logo
Yeah that one is fine.
Did you upgrade from v2 to v3?
Do you think I have something that is deprecated/changed from V2 in the forms thats breaking it?
Yep
Well, that's an important information. Why don't you tell that? 🙈
Are you using
<x-forms::
anywhere?
It was renamed to <x-filament-forms::
No. These are used in custom filament components right? I changed them to <x-filament-forms::
Seems like you missed one. Do a global search for it
Maybe also in a plugin you use?
oh. Maybe. I'll have a look.
@Dennis Koch Is something wrong here?
This is the
class OrderLineForm extends Forms\Components\Field
{
protected string $view = 'forms::components.group';
public function getChildComponents(): array
{
return [
Repeater::make('order_lines')
->label('')
->addActionLabel('Add Line')
->minItems(1)
->collapsible()
->schema([
Select::make('purchasable_id')
->options(ProductVariant::all(['name', 'id'])->pluck('name', 'id'))
->label('Product Variant')
->reactive()
->afterStateUpdated(function ($state, callable $set) {
/* @phpstan-ignore-next-line */
$set('total', (string)ProductVariant::query()->find($state)?->price);
})
->loadingMessage('Fetching price.')
->required(),
TextInput::make('quantity')
->label('Quantity')
->numeric()
->required()
->default(1)
->minValue(1)
->hidden(fn (Get $get) => $get('purchasable_id') === null),
TextInput::make('total')
->label('Price Per Item')
->hidden(fn (Get $get) => $get('purchasable_id') === null)
->placeholder('00000.00')
->prefix('£')
->mask(RawJs::make(
<<<'JS'
$money($input, '.', ',', 2)
JS
))
->required(),
TextInput::make('discount_total')
->label('Discount Per Unit')
->hidden(fn (Get $get) => $get('purchasable_id') === null)
->placeholder('00000.00')
->prefix('£')
->mask(RawJs::make(
<<<'JS'
$money($input, '.', ',', 2)
JS
))
->default('0.00'),
]),
];
}
}
class OrderLineForm extends Forms\Components\Field
{
protected string $view = 'forms::components.group';
public function getChildComponents(): array
{
return [
Repeater::make('order_lines')
->label('')
->addActionLabel('Add Line')
->minItems(1)
->collapsible()
->schema([
Select::make('purchasable_id')
->options(ProductVariant::all(['name', 'id'])->pluck('name', 'id'))
->label('Product Variant')
->reactive()
->afterStateUpdated(function ($state, callable $set) {
/* @phpstan-ignore-next-line */
$set('total', (string)ProductVariant::query()->find($state)?->price);
})
->loadingMessage('Fetching price.')
->required(),
TextInput::make('quantity')
->label('Quantity')
->numeric()
->required()
->default(1)
->minValue(1)
->hidden(fn (Get $get) => $get('purchasable_id') === null),
TextInput::make('total')
->label('Price Per Item')
->hidden(fn (Get $get) => $get('purchasable_id') === null)
->placeholder('00000.00')
->prefix('£')
->mask(RawJs::make(
<<<'JS'
$money($input, '.', ',', 2)
JS
))
->required(),
TextInput::make('discount_total')
->label('Discount Per Unit')
->hidden(fn (Get $get) => $get('purchasable_id') === null)
->placeholder('00000.00')
->prefix('£')
->mask(RawJs::make(
<<<'JS'
$money($input, '.', ',', 2)
JS
))
->default('0.00'),
]),
];
}
}
OrderLineForm
from the full form schema code that I sent before. Removing OrderLineForm
from the form schema lets the form render properly.
Is it not possible to extend Forms\Components\Field
and add that a field in form schema?Check the view property. It’s
forms::
. That’s the issueRight. Thank You. What should be the right one?
Solution
filament-forms
That worked! Thanks a lot @Dennis Koch