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

pranab19891
pranab19891

I'm new to October CMS and learning to create a Form Widget. But I'm getting the following error :

The partial '_field_actorbox.htm' is not found.
/opt/lampp/htdocs/octobermovies/modules/system/traits/ViewMaker.php line 65

My widget folder name is 'formwidgets' My partials file name inside partials folder is '_widget.htm' Content of my formwidgets > Actorbox.php

namespace Watchlearn\Movies\FormWidgets;

use Backend\Classes\FormWidgetBase;
use Config;

class ActorBox extends FormWidgetBase
{
    public function widgetDetails()
    {
        return [
            'name' => 'Actorbox',
            'description' => 'Field for adding actors'
        ];
    }

    public function render(){
        return $this->makePartial('widget');
    }

    public function loadAssets()
    {
        $this->addCss('css/select2.css');
        $this->addJs('js/select2.js');
    }
}

My code to register the widget in plugin.php

public function registerFormWidgets()
    {
        return [
            'Watchlearn\Movies\FormWidgets\ActorBox' => [
                'label' => 'ActorBox Field',
                'code' => 'actorbox'
            ]
        ];
    }

I tried to find and looked into the documentation also but could not find any solution for this.

alxy
alxy

The problem is that your form widget is not properly registered (as in: The system doesn't know a formwdiget with the code actorbox exists). Thats why it is assuming its a partial type and tries to load _field_actorbox.htm.

So here are a few things to check:

  • Is your plugin recognized by the October plugin. Please check if it is listed under Settings > Updates or try to register a navigation item and see if that displays.
  • Check for any spelling mistakes, especially in your registerFormWidgets-method. Output something from there (using dd()) to actually confirm it is ever called.
  • Depending on your October Version, you might want to adjust your registration code to respect the new simplified registration procedure: http://octobercms.com/docs/backend/widgets#form-widget-registration
pranab19891
pranab19891

alxy said:

The problem is that your form widget is not properly registered (as in: The system doesn't know a formwdiget with the code actorbox exists). Thats why it is assuming its a partial type and tries to load _field_actorbox.htm.

So here are a few things to check:

  • Is your plugin recognized by the October plugin. Please check if it is listed under Settings > Updates or try to register a navigation item and see if that displays.
  • Check for any spelling mistakes, especially in your registerFormWidgets-method. Output something from there (using dd()) to actually confirm it is ever called.
  • Depending on your October Version, you might want to adjust your registration code to respect the new simplified registration procedure: http://octobercms.com/docs/backend/widgets#form-widget-registration

Thank you @alxy for your response. I tried what to wanted me to do and found that the plugin in which I'm creating the widget is there in the Settings > Update. But registerFormWidgets - method is never called. I tried to print something in the method by using dd() but nothing happens.

taha.azzabi14703
taha.azzabi14703

Hello In your plugin you have registered a FormWidgets with code: actorbox
And in render function you call :
return $this->makePartial('widget');
Does not exist you need to change like this :

file formwidgets > Actorbox.php
public function render(){ return $this->makePartial('widget'); }
See this example here : https://www.sitepoint.com/building-octobercms-form-field-widgets-like-a-pro/

Last updated

pushkar9168
pushkar9168

I know this is too late to reply on this issue but I have already face this issue and the solution is move your "ActorBox" class file from "actorbox" folder to "formwidget" folder. And this will solve your problem.

Bandab
Bandab

@pushkar9168 Thank You! Moving formwidget class file to the formwidgets directory solved my issue.

ruslan.ponomarev56855
ruslan.ponomarev56855

pushkar9168 said:

I know this is too late to reply on this issue but I have already face this issue and the solution is move your "ActorBox" class file from "actorbox" folder to "formwidget" folder. And this will solve your problem.

Really helpful, thank you!

1-7 of 7

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