Need to show and hide a field description based on the drop-down selection | Community
Skip to main content
samsundar23
Level 4
January 28, 2021
Solved

Need to show and hide a field description based on the drop-down selection

  • January 28, 2021
  • 3 replies
  • 3473 views

I'm using AEM 6.5 and I want to show the field description only for "no-image" drop-down value.

I want to hide the field description for rest of all drop-down selection.

Kindly let me know an option to do this activity (i.e., show and hide the field description based on drop-down selection.).

 

Thanks

SHYAMSUNDAR TK

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 Anudeep_Garnepudi

@samsundar23 

Use below dialog listener code snippet.

jQuery(document).on("dialog-ready", function() { $("[name='./banner-style']").on("change", function (e) { if (e.target.selectedItem.value === "no-image") { $(e.target).closest(".coral-Form-fieldwrapper").find("coral-icon").show(); $(e.target).closest(".coral-Form-fieldwrapper").find("coral-tooltip").show(); } else { $(e.target).closest(".coral-Form-fieldwrapper").find("coral-icon").hide(); $(e.target).closest(".coral-Form-fieldwrapper").find("coral-tooltip").hide(); } }); });

3 replies

Anudeep_Garnepudi
Community Advisor
Anudeep_GarnepudiCommunity AdvisorAccepted solution
Community Advisor
January 28, 2021

@samsundar23 

Use below dialog listener code snippet.

jQuery(document).on("dialog-ready", function() { $("[name='./banner-style']").on("change", function (e) { if (e.target.selectedItem.value === "no-image") { $(e.target).closest(".coral-Form-fieldwrapper").find("coral-icon").show(); $(e.target).closest(".coral-Form-fieldwrapper").find("coral-tooltip").show(); } else { $(e.target).closest(".coral-Form-fieldwrapper").find("coral-icon").hide(); $(e.target).closest(".coral-Form-fieldwrapper").find("coral-tooltip").hide(); } }); });
samsundar23
Level 4
January 29, 2021

Thanks a lot @anudeep_garnepudi !

Your recommendation worked wonders for me.

🙂

ChitraMadan
Community Advisor
Community Advisor
January 28, 2021
samsundar23
Level 4
March 30, 2021

Thanks again @anudeep_garnepudi  !