How can I clear data from dialog when user picks a different granite select? | Community
Skip to main content
Level 3
October 11, 2016
Solved

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

  • October 11, 2016
  • 5 replies
  • 4392 views

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>
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

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

5 replies

Pawan-Gupta
Level 8
October 11, 2016

yes, you have to write listener on selection change and clear whichever field value you want or modify. refer below

https://helpx.adobe.com/experience-manager/using/creating-touchui-events.html

https://helpx.adobe.com/experience-manager/using/creating-touchui-dynamic.html

kautuk_sahni
Community Manager
kautuk_sahniCommunity ManagerAccepted solution
Community Manager
October 13, 2016

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
October 24, 2022

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

 

squid267Author
Level 3
October 17, 2016

Thanks everyone

vidyab9364493
February 4, 2019

Any idea how to clear selection fields in classic ui?

April 30, 2019

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