?
avatar mboucetta
mboucetta
11 Oct 2016

Steps to reproduce the issue

I am developing a component.
In this component I would like to add an input tag field (the same you have when you create an article).This input will be associated to a custom search panel. I tried:
$tags= JFormHelper::loadFieldType('Tag');
echo $tags->input;
But it returns an error:
Fatal error: Call to a member function getName() on null in C:\wamp64\www\mynotes\libraries\cms\form\field\tag.php on line 155

Indeed to be able to execute JFormFieldTag::getInput a form object is required. See tag.php -> getOptions():
if ($this->form->getName() == 'com_tags.tag')

Expected result

I am expecting a tag input field as when you create an article.

Actual result

Fatal error: Call to a member function getName() on null in C:\wamp64\www\mynotes\libraries\cms\form\field\tag.php on line 155

System information (as much as possible)

joomla Joomla! 3.6.2 / Windows 7 / WAMP 3.0.6

Additional comments

Maybe it is not a bug but a misuse. If so please let me know the correct procedure.

avatar mboucetta mboucetta - open - 11 Oct 2016
avatar mboucetta mboucetta - edited - 11 Oct 2016
avatar mbabker
mbabker - comment - 11 Oct 2016

Form fields aren't really designed to be used outside of the "normal" form constructs. It is a requirement to have a JForm object set to JFormField instances, so if you're trying to use the field to spit out markup outside of the "normal" workflow you'll need to build up a stub JForm object with the minimal config needed to make this work.

avatar brianteeman
brianteeman - comment - 11 Oct 2016

I am closing this here. this is an issue about using the code not a bug in the code and you already have a topic on the correct google group for support/help

avatar brianteeman brianteeman - change - 11 Oct 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-10-11 15:47:02
Closed_By brianteeman
avatar brianteeman brianteeman - close - 11 Oct 2016
avatar brianteeman brianteeman - close - 11 Oct 2016
avatar brianteeman brianteeman - change - 19 Oct 2016
Labels Added: ?

Add a Comment

Login with GitHub to post a comment