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

Avatar

Avatar

aravindS

Avatar

aravindS

aravindS

04-11-2019

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.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Reply

838

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Reply

838
Arun_Patidar
MVP

05-11-2019

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.

Answers (4)

Answers (4)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Reply

838

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Reply

838
Arun_Patidar
MVP

07-11-2019

Please check JavaScript DOM HTML

Avatar

Avatar

aravindS

Avatar

aravindS

aravindS

06-11-2019

Hi,

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

Thanks.

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Reply

838

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Reply

838
Arun_Patidar
MVP

06-11-2019

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.

Avatar

Avatar

aravindS

Avatar

aravindS

aravindS

06-11-2019

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.