Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

AEM 6.4 Sightly Issue - Textfield not displaying special characters properly

Avatar

Avatar
Validate 1
Level 2
angthefire
Level 2

Likes

3 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
angthefire
Level 2

Likes

3 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Applaud 5
View profile
angthefire
Level 2

11-12-2018

Hi Team,

I have a requirement to render special characters like "doublequote" ("), "quote" ('), "less than" (<), "greater than" (>) in textfield/pathfield.

The problem now is these characters get HTML encoded in the view source page.

So, if an Input expression in textfield is

<%= formatDate(new Date(), "%2D.%2M.%4Y") %>

It is displayed as

&lt;%= formatDate(new Date(), &#34;%2D.%2M.%4Y&#34;) %&gt;

Expected result: <%= formatDate(new Date(), "%2D.%2M.%4Y") %>

I have tried using context='unsafe' but it is not working (worked for AEM 6.3). I tried calling this value using java but the input expression is fetched correctly in the method, the encoding is done later.

Is there a way to get the expected result?

Replies

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,345 likes

Total Posts

3,220 posts

Correct Reply

914 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,345 likes

Total Posts

3,220 posts

Correct Reply

914 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

11-12-2018

Hi,

Are you using JSP or HTL? Context works only with HTL but your functions seems a JSP code. HTL will be considering this as text will be displaying as it is.

<h2>Display Current Date & Time</h2>

<p>${properties.text @context='unsafe'}</p>

<p>${properties.text}</p>

Screenshot 2018-12-11 at 5.40.34 PM.png

Avatar

Avatar
Validate 1
Level 2
angthefire
Level 2

Likes

3 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
angthefire
Level 2

Likes

3 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Applaud 5
View profile
angthefire
Level 2

11-12-2018

Hi Arun,

Thanks for the reply.

I am using HTL in the same way as you have used in the example and getting the exact same result in inspect element console as shown in snapshot.

However, the issue is when I right click on the page and choose the option "View Page Source", there the output is different.

And as I mentioned earlier, I wasn't facing this issue with AEM6.3, only after upgrading to 6.4 the problem appeared.

Avatar

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

274 likes

Total Posts

1,502 posts

Correct Reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

274 likes

Total Posts

1,502 posts

Correct Reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile
edubey
Level 10

11-12-2018

This is what i see on page

1644737_pastedImage_0.png

and this on view source

1644738_pastedImage_1.png

I am not sure whats the confusion, can you elaborate

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,345 likes

Total Posts

3,220 posts

Correct Reply

914 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,345 likes

Total Posts

3,220 posts

Correct Reply

914 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

13-12-2018

Hi,

Its working fine with unsafe context

<h2>Display Current Date & Time</h2>

<p>${properties.text @context='unsafe'}</p>

<p>${properties.text}</p>

Agree with Praveen, not sure what is the confusion.

Screenshot 2018-12-13 at 4.28.28 PM.png

Avatar

Avatar
Validate 1
Level 2
angthefire
Level 2

Likes

3 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 2
angthefire
Level 2

Likes

3 likes

Total Posts

10 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 3
Boost 1
Applaud 5
View profile
angthefire
Level 2

18-12-2018

The code seems to work fine now. Not sure why it wasn't working earlier. Thanks edubey and Arun.