Latest Posts


Showing posts with label cq5 dialog. Show all posts
Showing posts with label cq5 dialog. Show all posts
Creating nodes of a particular type creates a dialog in CQ5. How are they converted into java script?? What is the relationship between the node and the script??

CQ5 uses Extjs for its interface. So you can use most of the stuff that comes with extjs. The framework is customized a bit and instead of Ext class you have to use CQ.Ext a subset of extjs functionality.

The dialogs we see in cq5 interface are actually forms. On clicking OK the values in forms are submitted to the node using POST. Slings default post servlet stores values that have been posted if the request has required permissions.So when you create dialogs you are actually building fancy forms that looks good and appears in a pop up.

This post is a sequel to the post Creating cq5 component with a dialog (configurable component) - Part 1

Now that we have our dialog ready lets see how the data can be fetched in our jsp and displayed.

The data configured by the author are stored as properties of a node. Since cq5 is built on sling it treats everything as a content and content has resource. So instead of using the node,we can use resource to fetch the property. The properties are stored as a value map. We'll have to fetch the property from the value map.

CQ5 exposes valueMap of the components' resource as "properties" object (it is done in one of the files included in global.jsp . Make it a point to include global.jsp in every jsp). The valueMap has get() method which will return the value.

The steps in this tutorial will require knowledge of creating a component in cq5. If you do not know how its done , check out my post "creating cq5 component " .

Let us create a Blog post component. The component will enable the content authors to insert a blog post onto a page. The blog will have three parts viz title, short description and blog body.

step 1: In CRXDE lite navigate to apps/yourproject/components folder. Right click on the component folder and create a component with the label blogPost.

step 2: Right click on the component and select create dialog option. Give the name and title as dialog and dialog. This convention of naming it dialog is essential for it to work.