How to add a new property for the page using htl..? | Community
Skip to main content
Level 5
Nov 4, 2019 8:48 AM UTC
Solved

How to add a new property for the page using htl..?

Hi ,

Is there any way to add the add the new property to that page, like inside js function needs to add the property like

functionName-clicked  "true"

Like, how we are fetching the page property ${property.name}... is there any way to add a new property.

Thanks in advance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Nov 5, 2019 6:07 PM UTC

I would not suggest you to do that. At the publisher user should not have write access.

Technically it is possible, you just have to set a subservice user and when your page load you can check property and create it using subservice session inside Sling Model.

but consider another safer approach.

Arun Patidar

5 replies

arunpatidar
New Participant
Nov 7, 2019 10:43 PM UTC

Please check JavaScript DOM HTML

Translate
Arun Patidar
aravindSAuthor
Level 5
Nov 7, 2019 5:09 AM UTC

Hi,

Can you please elabrate how to change the property value using HTL inside the js function

Thanks.

Translate
arunpatidar
New Participant
Nov 6, 2019 10:38 PM UTC

Do you want to change property in AEM or in DOM.

In DOM, yes it is possible using javascript, you can write javascript/jquery code in HLT. You have to use scriptToken context while you write javascript code.

In repository as well, it is possible to change the value.

Translate
Arun Patidar
aravindSAuthor
Level 5
Nov 6, 2019 9:43 AM UTC

Hi Arun,

${properties.existing}

is there any way to change the value of property using sightly.

Ex;

<onclick or any function inside the script on html>

function(){

----- here needs to change the value for the property.

}

Thanks.

Translate
arunpatidar
arunpatidarAccepted solution
New Participant
Nov 5, 2019 6:07 PM UTC

I would not suggest you to do that. At the publisher user should not have write access.

Technically it is possible, you just have to set a subservice user and when your page load you can check property and create it using subservice session inside Sling Model.

but consider another safer approach.

Translate
Arun Patidar