Richeditor undefined error

I'm building an IT ticket system. I'm having a form and a infolist on a custom page. In the infolist the original ticket is show and the customer should be able to reply to the ticket. When I'm using a richeditor for the reply there is a message in the editor shown 'undefined'. When I'm replacing the editor with a simple text input it works well.
No description
Solution:
I think replyData should be empty because it's a create record form and not an edit form? I solved it by reading the docs once again. You should always initialize the form:
Initialize the form with $this->form->fill() in mount(). This is imperative for every form that you build, even if it doesn't have any initial data....
Jump to solution
3 Replies
Matthew
Matthew2w ago
public function createReply(Form $form): Form
{
return $form
->schema([
\Filament\Forms\Components\RichEditor::make('content')
->autofocus()
->required(),
])
->statePath('replyData')
->model(Reply::class);
}
public function createReply(Form $form): Form
{
return $form
->schema([
\Filament\Forms\Components\RichEditor::make('content')
->autofocus()
->required(),
])
->statePath('replyData')
->model(Reply::class);
}
I think its because when you first load the page, replyData is empty array
Solution
Rick Doetinchem
I think replyData should be empty because it's a create record form and not an edit form? I solved it by reading the docs once again. You should always initialize the form:
Initialize the form with $this->form->fill() in mount(). This is imperative for every form that you build, even if it doesn't have any initial data.

Did you find this page helpful?