Fetch input value of a CQ5 Form Text Component - aem

We want to fetch input value of a CQ5 Textbox Component used multiple times on a single page. We have added components as shown below:-
<cq:include path="lastname" resourcetype="demoproject/components/lastname">
<cq:include path="firstname" resourcetype="demoproject/components/firstname">
Where in firstname and lastname are extended cq5 form text components.
How can we get values of respective fields? We thought of giving unique ID's to each component but since we are using default CQ5 component we are not able to set different ID to each component included in our .jsp page.

Nithalia,
If you will include a component by cq:include then you will be stuck with only one instance of it and will never be able to use it dynamically.
You will have to drag multiple instances of this text component into the Parsys and then will have to configure each of that instance individually. A component when dragged into Parsys is independent of other component because a different node is created each time you drag it. While if you will include it only a single node will be created and hence editing can be made but only once.
If you want to do some research, drag the text component multiple times on Geomartixx site and configure them individually and see the nodes that will be created under the /content path.

Related

Using built in AEM form

The form component in AEM and all other form related components mandate that it should be used under parsys component (by dragging and dropping). When I use these form components without a parsys as their parent, are not behaving as expected for ex: form end component does not show submit button even though i have checked the option to show submit button.
Question: I want to use the form components but I don't want to use drag and drop. I want to create a reusable form component with predefined fields. Any way to achieve this?
Finally after a lot of searching, I found the best solution here :
http://versatileankur.blogspot.in/2014/11/component-with-default-components-in-cq5.html

How to build an AEM parsys that by default places new components at the top instead of bottom?

Is there a way to build/configure a parsys in AEM 6.0 such that when users drag new components from the sidekick, that the parsys will show a slot to add a new component at the top instead of the bottom (Referring to the box labeled "Drag components or assets here")? For example, I have a parsys with a list of articles and the articles are by default shown in descending order. When a user goes to add a new article I'd like them to by default add a new one at the top of the list in the parsys and not have to add to the bottom then re-order all the way from the bottom up. Is this possible in AEM 6.0?
Not sure if i understand your question correctly, but to explain how parsys work:
Parsys is a placeholder which allow authors/editors to drag and drop
components.
Editors can drop a new component before/below an existing component, which means parsys is already flexible enough to add new component anywhere.
Considering Your article list example, by forcing new component always on top, you will loose feature#2. I would recommend following options:
Use OOB parsys and handle this by governance.
or Create a component which render list of articles in descending order.

Component group not showing in sidekick (Adobe CQ)

Im using adobe CQ 5 and I have created a bunch of components.
For all these components I have set allowedParents to */parsys and I have defined the componentGroup as xyz.
My page contains the parsys component. When I enter the parsys design mode, the list of allowed components does not show the component group xyz.
Please help!
Thanks in advance
Kindly make sure that your components jcr:title is not the same as the component's name. For Eg: if the name of the component is text, then the title should at least be Text and not text. Change it and then check in the design mode, it will list your component group.
Please verify your Jcr:title (text) does not match with your component name. A difference needs to be mentioned i.e. if your component name is Title, then your jcr:title should have title. If the component is still not in sidekick after this, then add this too:
Add cq:editConfig to your component. This will enable you to add your component in sidekick. There is no need to create a dialog.
If your component does not have dialog then child node cq:editConfig enables the component to show in the sidekick. for more please visit http://www.cqtuts.com/cq5/cq5-component.html

Inheriting dialogs in Adobe CQ5

I'm trying to implement a component dialog by inheriting a dialog of a base component. I'm having troubles with dialogs when used twice.
BASE COMPONENT
dialog
text (name: "./text/content")
OTHER COMPONENT
dialog
text (inherited from base)
text (inherited from base)
settings
other
The problem with this is that it inherits the name as well and it doesn't look like you can override it. How can I make my jsp print out the two rich-text if they get inherited with the same name? Does CQ5 provide an index so that they can be referenced in the JSPs?
If your plan is to have two rich text areas in the dialog of components that inherit from the base, then you must include two rich text areas with unique names in the base component dialog.
Each input field of a dialog must have a unique name otherwise they will point to the same property path relative to the jcr:content node of the component when used on a page.
As mentioned above, Each input field of a dialog must have a unique name otherwise they will point to the same property path relative to the jcr:content node of the component when used on a page. Here, this will confuse the CRX while recognizing the textArea to be referred and the second one will not be referred.

Component without a dialog won't display in Sidekick

If a component is created, but a dialog.xml file isn't included within it, it will not show as available within the Sidekick, even if enabled in Design mode, and with a Component Group specified — why is this?
If you add a cq:editConfig node to the component it will show up in the sidekick, after being enabled in the design dialog of the parsys, without having a dialog.
As reference: http://dev.day.com/docs/en/cq/5-3/developing/components.html#Components and their structure
dialog boxes are meant for dynamically adding content to the components.
if there is no dialog box in a component there is no reason for component to display in sidekick .
u can directly hard code the component like this.
<cq:include path="par0" resourceType="/apps/...." />
Have you gone into the design portion to allow your component? I've often created a new component, and been unable to add it simply because I forgot to allow it in the design mode on that page.
EDIT
Good point - I do believe a dialog.xml file is required for it to show up in the sidekick. Otherwise you have to hard code the include of your component where you need it. I would suggest adding a dialog.xml file, even if it is only for the reason of showing it in the sidekick, so you can add it dynamically to different pages.