No hint path defined for [forms]

Hey! I am getting the following error when I navigate from a resource to its creation page.
No hint path defined for [forms]
No hint path defined for [forms]
Any idea why?
Solution:
filament-forms
Jump to solution
16 Replies
toeknee
toeknee16mo ago
Please provide your Schema for the form.
K R A T O S
K R A T O SOP16mo ago
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'),
]),
]);
}
Dennis Koch
Dennis Koch16mo ago
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.
K R A T O S
K R A T O SOP16mo ago
Yeah, I'll modify the placeholders. Thanks and What do you mean by published views of filament?
Dennis Koch
Dennis Koch16mo ago
Are there files in resources/views/vendor/filament and if yes which files are there?
K R A T O S
K R A T O SOP16mo ago
Just the logo
Dennis Koch
Dennis Koch16mo ago
Yeah that one is fine. Did you upgrade from v2 to v3?
K R A T O S
K R A T O SOP16mo ago
Do you think I have something that is deprecated/changed from V2 in the forms thats breaking it? Yep
Dennis Koch
Dennis Koch16mo ago
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::
K R A T O S
K R A T O SOP16mo ago
No. These are used in custom filament components right? I changed them to <x-filament-forms::
Dennis Koch
Dennis Koch16mo ago
Seems like you missed one. Do a global search for it Maybe also in a plugin you use?
K R A T O S
K R A T O SOP16mo ago
oh. Maybe. I'll have a look. @Dennis Koch Is something wrong here?
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'),
]),

];
}
}
This is the 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?
Dennis Koch
Dennis Koch16mo ago
Check the view property. It’s forms::. That’s the issue
K R A T O S
K R A T O SOP16mo ago
Right. Thank You. What should be the right one?
Solution
Dennis Koch
Dennis Koch16mo ago
filament-forms
K R A T O S
K R A T O SOP16mo ago
That worked! Thanks a lot @Dennis Koch
Want results from more Discord servers?
Add your server