HI,
I am trying to modify the text component, as per my client requirement, i have to keep the Headline & introduction of title components is mandatory for few templates. and not mandatory info page & info page-wide components,
Solved! Go to Solution.
Addition to above
Hi,
If your page component is different for each templates then you can find out pageResource in js and add validation on dialog submit
Granite.author.pageInfoHelper.json.pageResourceType
If your page component is same for mandatory and non-mandatory templates, the you can check template type using servlet and based on response add validation on dialog submit.
you can find page location in js using Granite.author.pageInfoHelper.json.status.path
Views
Replies
Total Likes
you can add default components to parsys by adding child node at the template level, check this OOTB example which is /apps/we-unlimited-app/templates/article/jcr:content/par/article
In your case, you need to add title component as a child node of the parsys
/app/your-project-name/templates/your-templates-name/jcr:content/name-of-the-parsys/title
When you create a page using the template by default the title component will appear on the page.
Did u mean that few of the fields of your title component should be mandatory for one set of pages and optional for other set of pages ?
Views
Replies
Total Likes
Yes for few set of pages, fields under title component is mandatory, for rest its optional.
Views
Replies
Total Likes
I assume you are referring to core components - you can override core components. See this HELPX artilce as an example of how to override a core component - Extending Adobe Experience Manager Core Components (this is an example of how to override a core component)
What he wants is lets say he has a title component with 3 fields in dialog. He want 2 field to be mandatory in Page 1 and optional in Page 2 . So its more like handling a field's required property depending upon the templates
Views
Replies
Total Likes
Are these components are default components on the page ?
If these components are default components then you can follow the same approach whatever I have mentioned earlier by adding by adding a required property to the component node.
If not default components then you write javascript which finds template type and based on that it will dynamically add the required property. it requires some R&D and Javascript knowledge
The simple and easy approach creates another version of the text component v2 that contains mandatory fields, but you need to convince the client on this.
Addition to above
Hi,
If your page component is different for each templates then you can find out pageResource in js and add validation on dialog submit
Granite.author.pageInfoHelper.json.pageResourceType
If your page component is same for mandatory and non-mandatory templates, the you can check template type using servlet and based on response add validation on dialog submit.
you can find page location in js using Granite.author.pageInfoHelper.json.status.path
Views
Replies
Total Likes
For a component, when you save a dialog.. write a listener and have a validation in place based on the resourceSuperType of that page. However as Rajas mentioned you need to have experience in JS to handle this.
Views
Replies
Total Likes
Views
Likes
Replies