Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Add Field to Tag in AEM 6.1 (Touch UI)

Avatar

Level 2

Hello
I need to add a custom field to the tags on my project. I haven't found documentation on how to do that. I found that the dialog for the tags is here:
/libs/cq/tagging/gui/content/tags/tagedit, I successfully added a new field there but it is not being persisted, I found the js code that sends the request to persist the data in tagedit.js, the data seems ok, but after an ajax call I lost track on where the actual save is being performed.
Any help would be appreciated. To summarize the question, besides shadowing /libs/cq/tagging/gui/content/tags/tagedit and adding the field I need there, what do I need to do for the data to persist correctly?

1 Accepted Solution

Avatar

Correct answer by
Level 2

Answering myself. I needed to modify the file tagedit.js specifically the foundation-contentloaded event so it loads the custom data, like:


var customField = res["customFieldName"];
$("#customFuieldId").val(customField);

View solution in original post

6 Replies

Avatar

Correct answer by
Level 2

Answering myself. I needed to modify the file tagedit.js specifically the foundation-contentloaded event so it loads the custom data, like:


var customField = res["customFieldName"];
$("#customFuieldId").val(customField);

Avatar

Level 10

Thanks for this - i am also searching to see if this is documented somewhere.

Avatar

Level 1

Thanks, Kreender.

This will add additional fields while editing the tags and persist the data for same.

I am wondering how to make it work on the creation of a tag.

Under creatag, we can able to add the fields, but on post command, I can see the data being passed. However the data is not persited?

Avatar

Level 3

I have the same question as above

how to make it work on the creation of a tag.?

Under creatag, we can able to add the fields, but on post command, I can see the data being passed. However the data is not persited?

Request URL: http://localhost:4502/bin/tagcommand

Request Method: POST

Status Code: 200 OK

Remote Address: [::1]:4502

Referrer Policy: no-referrer-when-downgrade

Content-Type: text/html; charset=UTF-8

Date: Mon, 11 Jun 2018 08:30:55 GMT

encoding: UTF-8

Transfer-Encoding: chunked

X-Content-Type-Options: nosniff

Accept: */*

Accept-Encoding: gzip, deflate, br

Accept-Language: en-US,en;q=0.9

Connection: keep-alive

Content-Length: 394

Content-Type: application/x-www-form-urlencoded; charset=UTF-8

Cookie: login-token=b628c5d2-b895-4d52-a59b-3d6606413360%3a47806882-47fa-4d53-8545-ca2bcd709b08_f0a2762aab9626fc%3acrx.default; cq-authoring-mode=TOUCH; wcmmode=edit; cq-editor-layer.page=Edit; cq-editor-sidepanel=closed

CSRF-Token: eyJleHAiOjE1Mjg3MDY0MzMsImlhdCI6MTUyODcwNTgzM30.HdKHv7hSgatcb_NOHXm5PSrG4ljEALwNBvQ-B0F83D0

Host: localhost:4502

Origin: http://localhost:4502

Referer: http://localhost:4502/libs/cq/tagging/gui/content/tags/createtag.html/etc/tags/

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36

X-Requested-With: XMLHttpRequest

tag: yrtet

jcr:title: yeyyq

jcr:description:

parentTagID: /etc/tags/xyz

_charset_: utf-8

cmd: createTag

myCustomTag: true

:cq_csrf_token: eyJleHAiOjE1Mjg3MDY0MzMsImlhdCI6MTUyODcwNTgzM30.HdKHv7hSgatcb_NOHXm5PSrG4ljEALwNBvQ-B0F83D0

Avatar

Level 2

Hi guys, any update? I have the same issue as above

how to make it work on the creation of a tag.?

Thank you.

Avatar

Level 1

Hi,

Change the property name from myCustomTag to jcr:myCustomTag and then give a try