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')
I am expecting a tag input field as when you create an article.
Fatal error: Call to a member function getName() on null in C:\wamp64\www\mynotes\libraries\cms\form\field\tag.php on line 155
joomla Joomla! 3.6.2 / Windows 7 / WAMP 3.0.6
Maybe it is not a bug but a misuse. If so please let me know the correct procedure.
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
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-10-11 15:47:02 |
Closed_By | ⇒ | brianteeman |
Labels |
Added:
?
|
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 toJFormField
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 stubJForm
object with the minimal config needed to make this work.