2

I would like to add tags via a front-end entry form - not like here, but as follows:

  • Text field in a front-end entry form where user add tags (separated by commas).
  • After pressing the save button, the plugin should:
  • check for every tag, whether it exists already (and create the tag if not)
  • save the tags together with the rest of the entry form [see also here](including the text field with the user defined tags)

Now, I am looking for a developer (I am willing to pay for it).

4

While the full answer to this probably requires some planning, and a plugin that handles various aspects of the tag management, here are a few components to consider:

You can submit tags from the front-end and, on the server side, they will behave like Craft handles them in the Control Panel. The syntax for your front-end form field is as follows:

<select multiple name="fields[fieldHandle][]">
  <option value="13">Tag Name One</option>
  <option value="42">Tag Name Two</option>
  <option value="144">Tag Name Three</option>
</select>

For a more friendly UI, there are a handful of javascript libraries that could help on the front-end. I believe the one that Craft uses in the Control Panel is selectize.js and it could be setup to be used on the front-end as well.

To handle the pre-processing of tag behavior before an Entry is saved, your plugin may need to use the entries.onBeforeSaveEntry Event.

  • Thank you for your answer. One of the challenges is that you can submit tags from the front-end only when you know the ID. selectize.js is really interesting - I will have a look at that. – MISC Jan 7 '16 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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