We are trying to achieve multifield dialog using TouchUI dialog where there will be two fields say Title and Link, which are part of multifield.
We would like to store these two values as <titlevalue>:<linkvalue> againist a property under appropriate content node after submission.
I have two dialog fields, say Title (with name as ./title) and Link (with name as ./link). Under normal dialog submission, the values will be stored in title and link properties. But i would like to get them stored under new property 'titleandlink' with its value as <titlevalue>:<linkvalue> where titlevalue and linkvalue are the values entered in the dialog.
Can you please advise me how to achieve this?
Read this community article -look at the code that is referenced in Github. It builds a dialog that uses a multifield. In this article - it writes out the multifield values to the web page. However - you can extend it and write the data to the JCR:
I would follow this, get it working and then extend it. The code taken from Github has a lot of useful code examples for AEM. In your JSP, get the data from the dialog and then call an AEM service that writes the data to the JCR. Consider this logic that writes the multifield dialog values to an AEM web page:
Extend this and capture the values and pass to an AEM service.
As far as writing data to the JCR using JCR API-- see this community example:
Hope this helps
Thank you Scott, for your inputs.
I am more interested to manipulate the data at the dialog level itself (like using cq:listeners like afteredit etc..) as they will be perfect place to act upon dialog data as soon as they get submitted.
I can also try using Java side of the component, provided it will get triggered before dialog data is written to content/../jcr-content/.. node.
Can you please point me to any classes in the JCR API i can use for this purpose?
My requirement is to build multifield dialog for touchUI, i want to write the value as String array in below format.
[title1:link1,title2:link2,title3:link3] provided user entered these values in the dialog in 3 containers (multifield) each containing two fields "Title" and "Link"
Can you please point me to any classes in the JCR API i can use for this purpose? or any example code to achieve the same?
You can write a Sighty component that does this. You can use Java in the component and then in the Java side of the component - use the JCR API to write to a JCR node property to meet your needs. Read this document to learn how to use a Sightly component that uses Java: