Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Send parameters to common cq dialog

Avatar

Level 2

Hi,

   I have a component with  a cq dialog with several tabs, they share the same content so i separate them. This is one of the tabs

<firstcardtab
   jcr:primaryType="nt:unstructured"
   jcr:title="First Card"
   sling:resourceType="granite/ui/components/foundation/section">
  <layout
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
   margin="{Boolean}false"/>
  <items jcr:primaryType="nt:unstructured">
  <column
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/container">
  <items jcr:primaryType="nt:unstructured">
  <tabconfig jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/coral/foundation/include"
   path="/components/content/homepage/featurededcthoughtleadership/cq:dialog/tabs/content" />
  </items>
  </column>
  </items>
</firstcardtab>

I have a select with cq-dialog-dropdown-showhide so I need to send a parameter in order to call the JS function with a different name, otherwise it will show and hide the options in the other tabs:

<cardType
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/form/select"
   class="cq-dialog-dropdown-showhide"
   cq-dialog-dropdown-showhide-target=".ftl-cardtype-showhide-target-1"
   fieldDescription="Determines the type of card to display."
   fieldLabel="Card Type"
   name="./cardtype">
  <items jcr:primaryType="nt:unstructured">
  <pullFromMostRecentOpt
   jcr:primaryType="nt:unstructured"
   text="Pull from most recent"
   value="pullfrommostrecent"/>
  <customAuthorOpt
   jcr:primaryType="nt:unstructured"
   text="Choose what to display"
   value="customauthor"/>
  </items>
</cardType>
<pullFromMostRecent
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/container"
   class="hide ftl-cardtype-showhide-target-1 foundation-layout-util-vmargin"
   showhidetargetvalue="pullfrommostrecent">
  <items jcr:primaryType="nt:unstructured">
  <noConfigNeeded
   sling:resourceType="granite/ui/components/coral/foundation/text"
   text="Configuration is not required for this card type"
   jcr:primaryType="nt:unstructured"/>
  </items>
</pullFromMostRecent>
<customAuthor
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/foundation/container"
   class="hide ftl-cardtype-showhide-target-1 foundation-layout-util-vmargin"
   showhidetargetvalue="customauthor">
  <items jcr:primaryType="nt:unstructured">
  <title
   sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
   fieldLabel="Title"
   fieldDescription="Text shown on the main screen"
   jcr:primaryType="nt:unstructured"
   name="./title"/>
  <position
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/coral/foundation/form/numberfield"
   fieldLabel="Position"
   fieldDescription="1: largest card, 2: left standard card, 3: right standard card, 4: first list card, 5: second list card.."
   min="1"
   max="7"
   name="./position"/>
  <url
   jcr:primaryType="nt:unstructured"
   sling:resourceType="/libs/granite/ui/components/coral/foundation/form/pathfield"
   fieldLabel="Link url"
   fieldDescription="Select page url"
   rootPath="/content/"
   name="./url"
   required="{Boolean}false"/>
  <externaldate
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/coral/foundation/form/datepicker"
   fieldLabel="Article Date"
   fieldDescription="Optional article date, if blank no date will be displayed."
   name="./externalDate"/>
  <image
   jcr:primaryType="nt:unstructured"
   sling:resourceType="cq/gui/components/authoring/dialog/fileupload"
   allowUpload="{Boolean}false"
   autoStart="{Boolean}true"
   class="cq-droptarget"
   fieldDescription="Image to show."
   fieldLabel="Image"
   fileNameParameter="./externalImageName"
   fileReferenceParameter="./externalImageReference"
   mimeTypes="[image]"
   multiple="{Boolean}false"
   name="./externalImage"
   title="Upload Image Asset"
   uploadUrl="${suffix.path}"
   useHTML5="{Boolean}true"
   required="{Boolean}false"/>
  <alt
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
   fieldLabel="Image alternate text"
   fieldDescription="Image alternate text."
   name="./externalImageAlt"/>

How do I send the parameters to this other file in common, something like this:

<tabconfig jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/coral/foundation/include"
   path="/components/content/homepage/featurededcthoughtleadership/cq:dialog/tabs/content @parameterfortab1" />

ANd how do I receive it?

Thanks,

5 Replies

Avatar

Level 10

Team replied --

1. add a simple custom include resource type based on /libs/granite/ui/components/coral/foundation/include/include.jsp, say /apps/my-project/include/include.jsp

2. pass the parameters

<myTas
   
jcr:primaryType="nt:unstructured"
   
sling:resourceType="
/apps/my-project/include"
   
path="/my/path/to/include?param1=value1&param2=value2"
/>

3. in /apps/my-project/include/include.jsp, get the path and parameters

4. use request dispatcher to include the path..

Avatar

Community Advisor

@maynors2427659 
Did you get an answer/solution for this?
If yes, then please share.

Avatar

Administrator

@maynors2427659  Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni