I have startDate as date field and year as tag Field. I have to fill year tagfield based on year of startDate and subsidary they are in.
Here you can see i am in cytech subsidary and startdate has 2012 . tag here is appled cytech:year/2012.
Now i want to do for all subsidaries when i chage or add date, the year tag should be automatically updated based on year in startDate and subsidary it is in. i have done using path based servlet by sending request and dynamically loaded using javascript. i want another approaches as many as possible. i am new to AEM and CMS. remember i am not using HTL as they are in page properties. feel free to ask for further information.
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
You can create an event listener which can update the year property, whenever start date property gets updated
https://medium.com/@toimrank/aem-handler-and-listener-12b6c8b5a3d3
You can create an event listener which can update the year property, whenever start date property gets updated
https://medium.com/@toimrank/aem-handler-and-listener-12b6c8b5a3d3
thanks . i will take a look into it and inform you if i have further doubts.
thanks . it helped me a lot.
Hi @AliSyed1
If you can already derive the tag-field (Year) value from the date-field (Start Date), there’s no need to add an additional authorable tag field (Year) in the page properties.
You can simply generate the Year value at the backend (using Sling Models, Services, etc.) wherever it's needed. If there’s specific context we're missing, please share. Otherwise, you can use a JavaScript event listener to achieve this, as AEM OSGi/Sling Resource listeners won’t help since the values are updated only after the page properties are submitted.
Thanks bro. My requirement is to change property in crx based on the subsidiaries name. I have done it using @AMANATH_ULLAH suggestion.