GithubHelp home page GithubHelp logo

Undefined variable: _form about forms HOT 5 CLOSED

khorsky avatar khorsky commented on June 15, 2024
Undefined variable: _form

from forms.

Comments (5)

khorsky avatar khorsky commented on June 15, 2024

Vypadá to na problém v makru, které vypisuje prvky do šablony. V proměných, které jsou šabloně prvku k dispozici, žádný $form není.

Minimální kód:

// MyControl.php

use Nextras\Forms\ComponentControl;
use Nextras\Forms\Controls\DatePicker;

class MyControl extends ComponentControl
{

  public function __construct($caption = NULL)
    {
      parent::__construct($caption);
      $this['checkbox'] = new DatePicker('My checkbox');
    }
}
<!-- MyControl.latte -->
{input checkbox}
class HomepagePresenter extends BasePresenter
{

  protected function createComponentMyForm()
    {
      $form = new Form;
      $form['myControl'] = new MyControl('My precious');

      return $form;
    }
}
<!-- šablona akce presenteru -->
{control myForm}

from forms.

hrach avatar hrach commented on June 15, 2024

Please, try https://github.com/nextras/forms/releases/tag/v2.0.2

from forms.

khorsky avatar khorsky commented on June 15, 2024

Unfortunately not working, I get an "end() expects parameter 1 to be array, null given" warning on line

if ($_label = end($this->global->formsStack)["checkbox"]->getLabel()) echo $_label ?>

There is no $this->global->formStack variable in the template. Cache was deleted.

from forms.

hrach avatar hrach commented on June 15, 2024

Finally and hopefully fixed in https://github.com/nextras/forms/releases/tag/v2.0.3

from forms.

khorsky avatar khorsky commented on June 15, 2024

Works like a charm, thanks!

from forms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.