Created
How To: Have your Dialog form fields write to arbitrary nodes
Recently I had a customer ask me to help them create a user profile page made up of multiple components with their individual dialogs e.g. address component, name component etc. However; they needed all the content to be written to a single "profile" node in the repository. The solution is fairly simple.
Configure your widget to write to a node (other than the current node)
In this case the "phone" field in the contact component dialog needed to write to the profile node. To do this,
1. Create your "phone" widget node as usual.
2. Set the value for the "name" property to "../profile/phone".
Configure your widget to load data from a node (other than the current node)
1. Create a node of type nt:unstructured under your widget node and call it "listeners".
2. Add a property called "loadcontent" to your listener node and set it's value to a function that retrieves content from another node and sets it to the field. e.g.
function(){this.setValue(CQ.Util.eval(CQ.HTTP.get(CQ.shared.HTTP.getPath()+'/_jcr_content/profile/phone.infinity.json')).phone);}
That's it! The field in your dialog will now read and write it's content from a "profile" node that is a sibling of the current node. Of course you can also use absolute paths if you need every instance of your component to read or write to a specific node in the repository.
COMMENTS
-
Thanks for sharing, I Think that is what I have been looking for.
-
How do you remove this?
-
Thanks for keeping us informed
-
Its great to see you taking the time to share this information
-
A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one.
-
I truly like the idea of having form fields available to use to write arbirtary notes. I think this will greatly expand the usage for these.
-
Another great post from you. Thanks for that! I must say that I have never heard about that problem before but now I understood everything. I will print this out and show to my friends, I think it will be interesting for them to read it too. Thanks!
-
Well this is very interesting indeed.Would love to read a little more of this. admire the valuable information you offer in your articles.
-
Thanks for sharing, I Think that is what I have been looking for.
Comments (9)