3

I would like to add a similar to default articles tag field type: A dropdown with predefined selects, but someone can add their own values also.

Joomla tags form field type

What type of field type is this? And how could I add it inside a custom component?

2

To save me repeating it all here, I'll link to this helpful article that explains it step by step:

http://magazine.joomla.org/issues/issue-apr-2103/item/1225-joomla-tag-field

  • Very detailed article, athough it describes the proccess for adding it at backend. Im trying to add it at the frontend. – sin Dec 1 '15 at 9:40
  • The process for adding it in the frontend should be just as simple :) – Phil Taylor Dec 1 '15 at 12:28
  • Altough i cant find a way to do it :( – sin Dec 2 '15 at 7:25
  • @sin, I can confirm that adding field is not complicated for FE, same as for BE, but you should prepare your custom component to use it. to do this you need to add jtableobservertags and your custom content-type. I can post full explanation if this is what you're looking for. – Alexandr May 29 '16 at 13:15
0

You can use the Tag form field type. This field type is available in Joomla 3.1 and newer, and works basically like this:

<field name="tags" type="tag" label="JTAG" description="JTAG_DESC" mode="ajax" class="inputbox span12 small" multiple="true" />

Note that mode="ajax" is required in order to allow on-the-fly tag creation.

More information on using tags in your extension can be found here.

  • My bad for not mentioning it. I need to add it at frontend not at backend. At the article you added, there is a way called "Batch Proccessing" but when i add the code it gives me back ONLY the dropdown list . – sin Dec 1 '15 at 9:37
0

Use the tag form field type:

//Get custom field
$getInput = JFormHelper::loadFieldType('Tag', false);
$taginput = $tags->getInput();

https://docs.joomla.org/Creating_a_custom_form_field_type#Not_linked_with_a_form

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.