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

How can I clear data from dialog when user picks a different granite select?

Avatar

Level 4

Hello

 

Working on a dialog box and I have a select box with two options. How can I clear the previous data when a user comes back into the dialog and selects the other option? I think this may requires some clientside js, but I want double check.

 

<cta1InternalExternalSelect jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/select" class="cq-dialog-dropdown-showhide" cq-dialog-dropdown-showhide-target=".list-option-listfrom-showhide-target" fieldLabel="Internal or External?" name="./slide1cta1internalExternalSelect"> <items jcr:primaryType="nt:unstructured"> <internal jcr:primaryType="nt:unstructured" text="Internal" value="slide1Cta1Internal"/> <external jcr:primaryType="nt:unstructured" text="External" value="slide1Cta1External"/> </items> </cta1InternalExternalSelect> <cta1SetInternal jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/container" class="hide list-option-listfrom-showhide-target foundation-layout-util-vmargin" showhidetargetvalue="slide1Cta1Internal"> <items jcr:primaryType="nt:unstructured"> <heading jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/heading" class="coral-Heading coral-Heading--4" level="{Long}4" text="Internal Link"/> <well jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/container"> <layout jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/layouts/well"/> <items jcr:primaryType="nt:unstructured"> <internalLink jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/pathbrowser" fieldLabel="Internal Link" name="./slide1Cta1InternalLink" rootPath="/content"/> </items> </well> </items> </cta1SetInternal> <cta1SetExternal jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/container" class="hide list-option-listfrom-showhide-target foundation-layout-util-vmargin" showhidetargetvalue="slide1Cta1External"> <items jcr:primaryType="nt:unstructured"> <heading jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/heading" class="coral-Heading coral-Heading--4" level="{Long}4" text="External Link"/> <well jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/container"> <layout jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/layouts/well"/> <items jcr:primaryType="nt:unstructured"> <externalLink jcr:primaryType="nt:unstructured" sling:resourceType="granite/ui/components/foundation/form/textfield" fieldLabel="External Link" fieldDescription="You need to include full link including https or http" name="./slide1Cta1ExternalLink"/> </items> </well> </items> </cta1SetExternal>
1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi,

As couple of ways i can think of here are:-

1. Using Touch UI vvalidation [Clear method] :- http://www.nateyolles.com/blog/2016/02/aem-touch-ui-custom-validation

2. As mentioned by Pawan to write listener. https://helpx.adobe.com/experience-manager/using/creating-touchui-dynamic.html

~kautuk



Kautuk Sahni

View solution in original post

6 Replies

Avatar

Correct answer by
Administrator

Hi,

As couple of ways i can think of here are:-

1. Using Touch UI vvalidation [Clear method] :- http://www.nateyolles.com/blog/2016/02/aem-touch-ui-custom-validation

2. As mentioned by Pawan to write listener. https://helpx.adobe.com/experience-manager/using/creating-touchui-dynamic.html

~kautuk



Kautuk Sahni

Avatar

Level 1

Hey there, 

 

I'm looking for the same solution but it seems the original links that you provided are now dead. Is there another way to these solutions or have they been scrubbed from the Adobe site?

 

All the best,

 

-TSmalley

 

Avatar

Level 1

Any idea how to clear selection fields in classic ui?

Avatar

Level 1

You should be able to create a listener and use the  reset() method on the fields.