How to restrict number of items that can be added in carousel? | Community
Skip to main content
Level 2
November 7, 2024
Solved

How to restrict number of items that can be added in carousel?

  • November 7, 2024
  • 3 replies
  • 729 views

I have created a proxy component that extends wcm/core/components/carousel/v1/carousel. I have restricted the allowed components. However now i want to restrict number of times we can add items,i.e, number of carousel cards.

how to achieve this?

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 GabrielMircea

You can do this multiple ways, javascript, java... But i suggest that in the dialog definition (cq:dialog), add a validation rule to limit the number of items that can be added. Assuming you know how to overlay a component.

 

https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/developing/platform/overlays

 

3 replies

GabrielMircea
GabrielMirceaAccepted solution
Level 2
November 7, 2024

You can do this multiple ways, javascript, java... But i suggest that in the dialog definition (cq:dialog), add a validation rule to limit the number of items that can be added. Assuming you know how to overlay a component.

 

https://experienceleague.adobe.com/en/docs/experience-manager-65/content/implementing/developing/platform/overlays

 

PRATHYUSHA_VP
Community Advisor
Community Advisor
November 7, 2024

Hi,

 

If you want to restrict the number of carousal fields in the component, you need to override dialog structure from core component.

 

You can keep all the created nodes empty and override just the no. of carousal fields and author it based on your requirement 

 

Hope this helps 

 

Thanks

Kamal_Kishor
Community Advisor
Community Advisor
November 7, 2024

@zendarkke : Please refer this previous question here. It explains different ways to achieve what you need.
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-to-restrict-number-of-component/td-p/420069

thanks.