0

I am attempting to add a custom control to a nette form, using the example given in the official documentation here.

I am having problems. First off I though I would try to use the example as a starting point. Unfortunately it doesn't work. when using the code provided I get

Notice: Uninitialized string offset: 0 in Composer\vendor\nette\utils\src\Utils\Html.php on line 494
Warning: Illegal offset type in Composer\vendor\nette\utils\src\Utils\Html.php on line 392

and only the label actually renders. Have I missed something obvious here or does the example just not work?

Khainestar
  • 307
  • 5
  • 11
  • 1
    What version of Nette Forms, Nette Utils and PHP do you use? The examples code you linked is for a rather old version version of Nette (2.2). – Jan Tojnar Jun 24 '21 at 18:45
  • PHP 7, and the Forms and Utils are the latest from Composer. I never noticed the date on those examples, They were linked off a post on the Nette forms from earlier this year so stupidly I thought they would be new.. I think I just need new examples. – Khainestar Jun 24 '21 at 22:18
  • 1
    You can try checking out later tags in the repo, e.g. https://github.com/nette/forms/blob/v3.1/examples/custom-control.php – Jan Tojnar Jun 25 '21 at 02:03
  • Yep that is the problem 100%, someone linked to an old version and I didn't notice the date. Using the new version I am getting some joy with output, just need to work out how to nest things now. – Khainestar Jun 25 '21 at 09:56

0 Answers0