This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
HI,
For tag edit the below links did work
http://www.flexibledesigns.rs/custom-fields-in-tag-dialogs-for-touch-ui/
https://forums.adobe.com/thread/2390213
But I want a custom textfield when submitted the values must get stored in crxde. Currently i added new field under body of
/apps/cq/tagging/gui/content/tags/createtag
The field comes up correctly on web browser but when clicked on submit the custom name field value is not getting saved on crx de.
Could some provide inputs as how this could be achieved.
Thanks.
Solved! Go to Solution.
Views
Replies
Total Likes
I found the solution to it
Added the new property under create tag
Step1:-
/apps/cq/tagging/gui/content/tags/createtag/jcr:content/body/items/form/items/wizard/items/createStep/items/fixedColumns/items/fixedC olumn1/items
<newtextproperty
granite:class="block"
granite:id="tagpimid"
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="proerty"
name="newtagproperty"
required="{Boolean}true"/>
Step2:-
under /apps/cq/tagging/gui/content/tags/createtag/jcr:content/body/items/form
Change the action to new custom servlet
sling:resourceType="granite/ui/components/coral/foundation/form"
action="/bin/tagcommandcreateext"
Step3:-
I found that ootb component on dialog creation sends data servlet /bin/tagcommand that is com.day.cq.tagging.servlets.TagCommandServlet
so decode and copy this code to your servlet and remove all the unwanted code expect for createtag code
Step4:- under your new servlet which has servlet path with "/bin/tagcommandcreateext"
private HtmlResponse createTag(TagManager tagManager, SlingHttpServletRequest request){
ResourceResolver resourceResolver = null;
Session session = null;
Map<String, Object> subService = new HashMap<>();
subService.put(ResourceResolverFactory.SUBSERVICE, SUB_SERVICE);
resourceResolver = resourceResolverFactory.getServiceResourceResolver(subService);
session = resourceResolver.adaptTo(Session.class);
try {
Tag tag = tagManager.createTag(tagID, request.getParameter("jcr:title"),
request.getParameter("jcr:description"));
Node tagNode = session.getNode(tag.getPath());
tagNode.setProperty("newtagproperty",
request.getParameter("newtagproperty"));
session.save();
return this.createResponse(200, type + " created", tag.getTagID(), tag.getPath());
}...
Views
Replies
Total Likes
Any inputs??
Views
Replies
Total Likes
modify the name and granite:id properly
then under tagedit.js
add the ff:
var myVariable = res["customField-ID"];
$("#customField-ID").var(myVariable);
btw, I'm 6.4 but I'm assuming it should work just the same.
Views
Replies
Total Likes
Thanks for the input. But i need the same to work when we use create option for tags
I did the same under but does not work
/apps/cq/tagging/gui/content/tags/createtag/jcr:content/body/items/form/items/wizard/items/createStep/items/fixedColumns/items/fixedColumn1/items
Do you have idea what could be reason??
Views
Replies
Total Likes
I found the solution to it
Added the new property under create tag
Step1:-
/apps/cq/tagging/gui/content/tags/createtag/jcr:content/body/items/form/items/wizard/items/createStep/items/fixedColumns/items/fixedC olumn1/items
<newtextproperty
granite:class="block"
granite:id="tagpimid"
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldLabel="proerty"
name="newtagproperty"
required="{Boolean}true"/>
Step2:-
under /apps/cq/tagging/gui/content/tags/createtag/jcr:content/body/items/form
Change the action to new custom servlet
sling:resourceType="granite/ui/components/coral/foundation/form"
action="/bin/tagcommandcreateext"
Step3:-
I found that ootb component on dialog creation sends data servlet /bin/tagcommand that is com.day.cq.tagging.servlets.TagCommandServlet
so decode and copy this code to your servlet and remove all the unwanted code expect for createtag code
Step4:- under your new servlet which has servlet path with "/bin/tagcommandcreateext"
private HtmlResponse createTag(TagManager tagManager, SlingHttpServletRequest request){
ResourceResolver resourceResolver = null;
Session session = null;
Map<String, Object> subService = new HashMap<>();
subService.put(ResourceResolverFactory.SUBSERVICE, SUB_SERVICE);
resourceResolver = resourceResolverFactory.getServiceResourceResolver(subService);
session = resourceResolver.adaptTo(Session.class);
try {
Tag tag = tagManager.createTag(tagID, request.getParameter("jcr:title"),
request.getParameter("jcr:description"));
Node tagNode = session.getNode(tag.getPath());
tagNode.setProperty("newtagproperty",
request.getParameter("newtagproperty"));
session.save();
return this.createResponse(200, type + " created", tag.getTagID(), tag.getPath());
}...
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies