Send parameters to common cq dialog | Community
Skip to main content
maynors2427659
Level 2
February 14, 2019

Send parameters to common cq dialog

  • February 14, 2019
  • 4 replies
  • 3427 views

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,

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

Gaurav-Behl
Level 10
February 14, 2019
smacdonald2008
Level 10
February 14, 2019

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..

Adobe Employee
July 27, 2020
pulkitvashisth
Community Advisor
Community Advisor
January 22, 2024

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

kautuk_sahni
Community Manager
Community Manager
January 23, 2024

@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