Hi All,
I need to pre-populate data into composite multi field by reading data from OSGI configuration file.This data should update based on drop down selection.
I am able to read the data from configuration file in JS,But even when i assigned data to fields ,while rendering time fields are showing as blank.
Views
Replies
Total Likes
Hi,
We could implement your use case by following the below helpx article:
Below is the sample dialog.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="Products FAQ Component"
sling:resourceType="cq/gui/components/authoring/dialog">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/tabs"
type="nav"/>
<items jcr:primaryType="nt:unstructured">
<product-section
jcr:primaryType="nt:unstructured"
jcr:title="Products"
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">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns">
<items jcr:primaryType="nt:unstructured">
<multifield
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/multifield"
class="full-width"
fieldDescription="Click '+' to add a new page and link">
<field
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/fieldset"
eaem-nested=""
name="./items">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"
method="absolute"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<question
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="Question"
name="./question"/>
<answer
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="Answer"
name="./answer"/>
<products
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/select"
defaultValue="Select a product"
fieldLabel="Select a product"
multiple="{Boolean}false"
name="./product">
<datasource
jcr:primaryType="nt:unstructured"
sling:resourceType="/apps/myproject/datasource/products"
addNone="{Boolean}true"/>
</products>
</items>
</column>
</items>
</field>
</multifield>
</items>
</layout>
</items>
</product-section>
</items>
</content>
</jcr:root>
Please find the screen-shots of sample OSGi configuration and dynamic drop-down inside a multi-field below:
OSGi configuration:
Sample dynamic drop-down inside multi-field:
We hope this helps!
Regards,
Views
Replies
Total Likes
Thank you for reply.
My use case is not related to dynamic drop down implementation.
In my use case i am having OSGI configuration having string array content,Those data i need to pre-populate in multi-field (having textfields) ,These text fields data would need to update when user change the drop down options.
Views
Replies
Total Likes