octobercms/october · error · ApplicationException

backend::lang.form.behavior_not_ready

Error message

backend::lang.form.behavior_not_ready

What it means

formRender throws the localized backend::lang.form.behavior_not_ready error when the Form widget has not been initialized yet — i.e. formRender() is called in a view before the form behavior's prepareVars/widget creation ran for the current action.

Solutions

  1. Ensure the controller action initializes the form behavior before the view renders formRender()
  2. Call formRender only from views belonging to configured form actions
  3. Check that the form widget is created (formInit ran) in the current context
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/backend/behaviors/FormController.php:533 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/6a08782170a891da. Report an issue: GitHub.

Appendix: source

Thrown at modules/backend/behaviors/FormController.php:533

    /**
     * formRender the prepared form markup. This method is usually called from a view file.
     *
     *     <?= $this->formRender() ?>
     *
     * The first argument supports an array of render options. The supported
     * options can be found via the `render` method of the Form widget class.
     *
     *     <?= $this->formRender(['preview' => true, 'section' => 'primary']) ?>
     *
     * @see Backend\Widgets\Form
     * @param array $options Render options
     * @return string Rendered HTML for the form.
     */
    public function formRender($options = [])
    {
        if (!$this->formWidget) {
            throw new ApplicationException(Lang::get('backend::lang.form.behavior_not_ready'));
        }

        // Sections provided by the behavior, then use the widget as fallback
        $section = strtolower($options['section'] ?? '');
        switch ($section) {
            case 'buttons':
                return $this->controller->formRenderDesignButtons();
        }

        return $this->formWidget->render($options);
    }

    /**
     * formRenderDesign renders a preset form design as either:
     * basic, custom, sidebar, document, popup
     */
    public function formRenderDesign($options = [])
    {

View on GitHub (pinned to b608633a7e)