TN
Posts: 0
Joined: Wed Jul 10, 2013 5:51 am

label text not escaped when using Set Local storage variable action

I created a test screen with a label containing text "B&G" and a button that when pressed, grabs the label text, sets a 'test' variable (using Set local storage variable action) and displays using
alert (localStorage.getItem('test'));

The text stored in the variable returns 'B & amp ; G' without spaces

Is there a way that I can get it to properly escape this character?

I also tested with a text area component and that seemed to return the correct string.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

label text not escaped when using Set Local storage variable action

Hi,

Run the following JavaScript code:
codelocalStorage.setItem( "name", "value & value" );/code

TN
Posts: 0
Joined: Wed Jul 10, 2013 5:51 am

label text not escaped when using Set Local storage variable action

Hello Katya,

I'm not sure I understand what value I'm meant to use.

I tried doing:
code
var n = Appery('SkuLabel');
localStorage.setItem("szSkuLookup", n.text() );
alert (localStorage.getItem('szSkuLookup'));
/code

The thing is my actual screen has a label within a grid and the label is mapped to json reponse array, so accessing the label text when the user clicks the label from the grid it return empty

TN
Posts: 0
Joined: Wed Jul 10, 2013 5:51 am

label text not escaped when using Set Local storage variable action

I used the following JS code as a workaround:

codelocalStorage.szSkuLookup = $(this).closest("[name=mobilegrid_121]").find('[name=SkuLabel]').text();/code

Not sure why the built-in click event for set variable action did not return the correct string. Could this be a bug?

Thanks.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

label text not escaped when using Set Local storage variable action

Hello,

Try to use Javascript with next code:

precode
Appery('mobilelabel_42').text("a \u0026 b");
localStorage.setItem("test","a \u0026 b");
/code/pre

Return to “Issues”