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

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

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.
kautuk_sahni
kautuk_sahniAccepted solution
Employee
Oct 13, 2016 7:10 AM UTC

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

6 replies

New Participant
Apr 30, 2019 8:45 AM UTC

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

Translate
vidyab9364493
New Participant
Feb 4, 2019 6:34 AM UTC

Any idea how to clear selection fields in classic ui?

Translate
squid267Author
Level 3
Oct 17, 2016 12:46 PM UTC

Thanks everyone

Translate
kautuk_sahni
kautuk_sahniAccepted solution
Employee
Oct 13, 2016 7:10 AM UTC

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

Translate
Kautuk Sahni
New Participant
Oct 24, 2022 2:17 PM UTC

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

 

Translate
Pawan-Gupta
Level 8
Oct 11, 2016 9:04 PM UTC

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

Translate