Created

Jun 06, 2012

How To: Have your Dialog form fields write to arbitrary nodes

Posted by Surya Lamech

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

  • By Mohamed Homaid - 10:16 PM on Jun 28, 2012   Reply
    Thanks for sharing, I Think that is what I have been looking for.
  • By Beverly Stevenson - 7:16 PM on Jul 22, 2012   Reply
    How do you remove this?
  • By nj photo booth - 5:10 PM on Apr 27, 2013   Reply
    Thanks for keeping us informed
  • By wedding photographers nj - 9:55 PM on Apr 27, 2013   Reply
    Its great to see you taking the time to share this information
  • By delhisitedesigningcompany.com - 2:37 PM on May 02, 2013   Reply
    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.
  • By http://5starlimorental.com - 5:23 PM on May 02, 2013   Reply
    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!
  • By cash advance online - 5:39 PM on May 12, 2013   Reply
    Well this is very interesting indeed.Would love to read a little more of this. admire the valuable information you offer in your articles.
  • By viagra - 5:36 PM on May 20, 2013   Reply
    Thanks for sharing, I Think that is what I have been looking for.