This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Demetrius
Demetrius

I've been stuck at this for about two days now. I'm currently writing a plugin, following the docs as closely as possible. However... When I tried to open my create/update pages, I get the error:

"Form behavior has not been initialized, check that you have called initForm() in your controller."

I have included Backend.Behaviors.FormController in the controller. I have also included the formConfig variable. I have a correctly formatted yaml file and a create.htm similar to the one in the docs. I tried everything. Followed the instructions from the docs exactly, but still getting the error. What could I be doing wrong? Thanks in advance.

Last updated

Daniel81
Daniel81

Try this in your controller:

public function index()
{
    $this->getClassExtension('Backend.Behaviors.FormController')->index();
}
Demetrius
Demetrius

Tried that, results in this error:

Call to undefined method Backend\Behaviors\FormController::index()

Daniel81
Daniel81

Can you paste your controller code here so we can see where the problem might be?

Demetrius
Demetrius

Controller code: http://laravel.io/bin/zXrDD

Form config yaml: http://laravel.io/bin/qYE36

Fields yaml (not complete yet): http://laravel.io/bin/78eDr

Last updated

Daniel81
Daniel81

Can you paste your create.htm also?

Demetrius
Demetrius
Demetrius

Really? Nobody who's had this before?

daftspunky
daftspunky

Tried actually calling this in your controller like the error message suggests?

$this-> initForm();
Demetrius
Demetrius

Found the culprit. Apparently, Sublime text was automatically adding 'tabs' to my yaml files when I jumped to a new line, thus causing a corrupt file. The formRender method simply couldn't read the yaml file and threw an error, because it wasn't receiving anything from the model and therefore thought initForm hadn't been called.

Last updated

1-10 of 10

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.