Expand my Community achievements bar.

granite/ui/components/foundation/form/select is not saving its value after re-opening the dialogue

Avatar

Level 2

Anyone could you suggestion me how to fix the below issue.

 

I am using a button component which uses some properties like style and icon which dropdown values with sling:resourceTyple: granite/ui/components/foundation/form/select, I am selecting some values and values are getting saved to jcr:content but when I re-open the component the values are getting reset to default.

 

Could you please suggest me what change is required to fix the issue.

10 Replies

Avatar

Community Advisor

@prash0905 Which version of AEM are you using?

Please try with Coral UI 3 type select and see how it works:

sling:resourceType="granite/ui/components/coral/foundation/form/select" 

Example: https://www.albinsblog.com/2019/02/how-to-handle-coral-ui-3-selectdropdown-change-event-touch-ui-dia... 

Avatar

Level 2

Thanks for your reply @Siva_Sogalapalli 

 

Unfortunately, the behaviour is same even after changing resource type

from sling:resourceType: granite/ui/components/foundation/form/select

to sling:resourceType: granite/ui/components/coral/foundation/form/select

 

Do I need any further modification or any properties to be added like value ?

Avatar

Community Advisor

Hi @prash0905 ,
Can you share the .xml for the dialog/field which you have created.

Avatar

Level 2

Hi @Anmol_Bhardwaj 

Please find the xml below. Kindly correct me if any issues

<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="Button Component" sling:resourceType="cq/gui/components/authoring/dialog" extraClientlibs="[project-xxx.button.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">
<tab1 jcr:primaryType="nt:unstructured" jcr:title="Button" sling:resourceType="granite/ui/components/foundation/container">
<layout jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<columns jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<lpos jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/textfield" class="buttonClass button-lpos" fieldLabel="LPOS" name="./lpos" required="true" value="button"/>
<buttonType jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="button-type buttonClass sdp-button-content" fieldLabel="Button Type" name="./buttonType" type="button">
<datasource jcr:primaryType="nt:unstructured" sling:resourceType="/apps/project-xxx/components/content/datasource"/>
</buttonType>
<buttonLabel jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/textfield" class="button-label" fieldLabel="Button Label" name="./buttonLabel"/>
<dataAdobeLinktype jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="button-linktype buttonClass" fieldLabel="Data Adobe Linktype" name="./linktype" required="true" type="icons-linktype">
<datasource jcr:primaryType="nt:unstructured" sling:resourceType="/apps/project-xxx/components/content/datasource"/>
</dataAdobeLinktype>
<dataLid jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/textfield" class="buttonClass" fieldLabel="Link LID" maxlength="{Long}100" name="./lid" required="true" value="default"/>
<action jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="button-action buttonClass" fieldLabel="Action" name="./action" required="true">
<items jcr:primaryType="nt:unstructured">
<sametab jcr:primaryType="nt:unstructured" text="Same Tab" value="_self"/>
<newtab jcr:primaryType="nt:unstructured" text="New Tab" value="_blank"/>
<Modal jcr:primaryType="nt:unstructured" text="Modal" value="modal"/>
</items>
</action>
<buttonDestination jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/pathbrowser" class="button-destination buttonClass" fieldLabel="Button Destination" name="./buttonDestination" rootPath="/content"/>
<icon jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="button-icon buttonClass" fieldLabel="Icon" name="./icon" type="icons-button">
<datasource jcr:primaryType="nt:unstructured" sling:resourceType="/apps/project-xxx/components/content/datasource"/>
</icon>
<buttonStyle jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="button-style buttonClass" fieldLabel="Button Style" name="./buttonStyle" type="button_styles">
<datasource jcr:primaryType="nt:unstructured" sling:resourceType="/apps/project-xxx/components/content/datasource"/>
</buttonStyle>
<buttonSize jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="buttonClass" fieldLabel="Button Size" name="./buttonSize">
<items jcr:primaryType="nt:unstructured">
<regular jcr:primaryType="nt:unstructured" selected="{Boolean}true" text="Regular" value="regular"/>
<small jcr:primaryType="nt:unstructured" text="Small" value="small"/>
</items>
</buttonSize>
<outline jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="button-outline buttonClass" fieldDescription="Indicates whether a primary style button should have an outline." fieldLabel="Outline" name="./outline">
<items jcr:primaryType="nt:unstructured">
<false jcr:primaryType="nt:unstructured" selected="{Boolean}true" text="False" value="{Boolean}false"/>
<true jcr:primaryType="nt:unstructured" text="True" value="{Boolean}true"/>
</items>
</outline>
</items>
</columns>
</items>
</tab1>
</items>
</content>
</jcr:root>

 

Avatar

Employee

Hi, prash0905

Which version of AEM are you using?I remember that I have met this issue before when using the early version.

Avatar

Level 2

Hi @birdccc 

 

Thanks for your reply. I am using AEM 6.5.8 version.

 

Avatar

Community Advisor

@prash0905 is it possible to share the dialog.xml here? so that we can have a look. 

Avatar

Level 2

Thanks for reply @Siva_Sogalapalli 

Xml is below.

<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="Button Component" sling:resourceType="cq/gui/components/authoring/dialog" extraClientlibs="[project-xxx.button.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">
<tab1 jcr:primaryType="nt:unstructured" jcr:title="Button" sling:resourceType="granite/ui/components/foundation/container">
<layout jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<columns jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<lpos jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/textfield" class="buttonClass button-lpos" fieldLabel="LPOS" name="./lpos" required="true" value="button"/>
<buttonType jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="button-type buttonClass sdp-button-content" fieldLabel="Button Type" name="./buttonType" type="button">
<datasource jcr:primaryType="nt:unstructured" sling:resourceType="/apps/project-xxx/components/content/datasource"/>
</buttonType>
<buttonLabel jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/textfield" class="button-label" fieldLabel="Button Label" name="./buttonLabel"/>
<dataAdobeLinktype jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="button-linktype buttonClass" fieldLabel="Data Adobe Linktype" name="./linktype" required="true" type="icons-linktype">
<datasource jcr:primaryType="nt:unstructured" sling:resourceType="/apps/project-xxx/components/content/datasource"/>
</dataAdobeLinktype>
<dataLid jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/textfield" class="buttonClass" fieldLabel="Link LID" maxlength="{Long}100" name="./lid" required="true" value="default"/>
<action jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="button-action buttonClass" fieldLabel="Action" name="./action" required="true">
<items jcr:primaryType="nt:unstructured">
<sametab jcr:primaryType="nt:unstructured" text="Same Tab" value="_self"/>
<newtab jcr:primaryType="nt:unstructured" text="New Tab" value="_blank"/>
<Modal jcr:primaryType="nt:unstructured" text="Modal" value="modal"/>
</items>
</action>
<buttonDestination jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/pathbrowser" class="button-destination buttonClass" fieldLabel="Button Destination" name="./buttonDestination" rootPath="/content"/>
<icon jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="button-icon buttonClass" fieldLabel="Icon" name="./icon" type="icons-button">
<datasource jcr:primaryType="nt:unstructured" sling:resourceType="/apps/project-xxx/components/content/datasource"/>
</icon>
<buttonStyle jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="button-style buttonClass" fieldLabel="Button Style" name="./buttonStyle" type="button_styles">
<datasource jcr:primaryType="nt:unstructured" sling:resourceType="/apps/project-xxx/components/content/datasource"/>
</buttonStyle>
<buttonSize jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="buttonClass" fieldLabel="Button Size" name="./buttonSize">
<items jcr:primaryType="nt:unstructured">
<regular jcr:primaryType="nt:unstructured" selected="{Boolean}true" text="Regular" value="regular"/>
<small jcr:primaryType="nt:unstructured" text="Small" value="small"/>
</items>
</buttonSize>
<outline jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="button-outline buttonClass" fieldDescription="Indicates whether a primary style button should have an outline." fieldLabel="Outline" name="./outline">
<items jcr:primaryType="nt:unstructured">
<false jcr:primaryType="nt:unstructured" selected="{Boolean}true" text="False" value="{Boolean}false"/>
<true jcr:primaryType="nt:unstructured" text="True" value="{Boolean}true"/>
</items>
</outline>
</items>
</columns>
</items>
</tab1>
</items>
</content>
</jcr:root>

Avatar

Employee

use granite/ui/components/coral/foundation/form/select

rather than granite/ui/components/foundation/form/select.

 

If it does'nt work.

You can try to overlay the /libs/granite/ui/components/coral/foundation/form/select/render.jsp and add some log in the key line which render the selected item.

Avatar

Level 1

Hi @prash0905I am also facing the same issue. Did you get any working solution for it?