Hi,
Need your thought on this:
I have multifield dialog with rich text and I need to add some dynamic html attributes in anchor link:
My thoughts:
1. I can add a component specific client lib with category "cq.authoring.dialog" and then on keyup event I can get the html string and add html attribute in this string, then save it back.
If this is correct approach then I need your suggestions how I can get dialog properties in client lib file? Also, I need to do this on author instance only.
2. My second thought is, I can add a sling modal and handle this on java side and return a formatted JSON
3. First I can set it through sly.set and added into a div container, then get div element by JS and add the html attributes, then set it back [this not preferable]
Ex:
Also, after this formatting I need to send this JSON to a SPA, So I don't want to this on SPA's script.
Kindly suggest good approach. I appreciate any feedback you share.
Thanks
Abhishek
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @Abhishekty,
If you want to store data in repository with your dynamically added attributes, than option 2 and 3 will not be the good one, because they only decorates values stored in crx, and if you will request for it via OOTB REST api, those values will not be included.
Option 1 looks interesting, but again, if in the future you will decide to use REST api to modify content the change will not be applied.
Keeping in mind above, I would recommend to use SlingPostProcessor - this is OOTB mechanism that is executed automatically whenever you send POST that is handled via SlingPostServlet. SlingPostServlet is used by default every time you are saving your dialog, but also when you are manipulating data using curl.
This will guarantee consistency of your data in repository.
Here you can find a very simple example of modification data via SlingPostProcessor:
For point 1 you can follow this link to read and update the values of dialog from client libs https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/set-current-page-title-to-...
point 2 is straightforward and let me know if you need any assistance on that as well
Hi @Abhishekty,
If you want to store data in repository with your dynamically added attributes, than option 2 and 3 will not be the good one, because they only decorates values stored in crx, and if you will request for it via OOTB REST api, those values will not be included.
Option 1 looks interesting, but again, if in the future you will decide to use REST api to modify content the change will not be applied.
Keeping in mind above, I would recommend to use SlingPostProcessor - this is OOTB mechanism that is executed automatically whenever you send POST that is handled via SlingPostServlet. SlingPostServlet is used by default every time you are saving your dialog, but also when you are manipulating data using curl.
This will guarantee consistency of your data in repository.
Here you can find a very simple example of modification data via SlingPostProcessor:
Views
Likes
Replies
Views
Likes
Replies