Save checkbox values to local storage

This forum contains topics that were moved from Get Satisfaction
Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

Save checkbox values to local storage

Post by Serhii Kulibaba »

What code exactly do you use here and what result do you expect to see here?

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Save checkbox values to local storage

Post by Ellen Schlechter »

This is the code I use:

prevar arrayJS = value.C;
console.log("arrayJS = ", arrayJS);
var arrayJSON = JSON.stringify(arrayJS);
console.log("arrayJSON = ", arrayJSON);

return arrayJSON;/pre

My expectation: Since there are two items in the popup (see screenshot above), I would expect to see two of the long ids as listed on the left column and then both a and b as it is typed on the right side. Instead, it just grabs values from the first row, but I want values from each row that is there.

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

Save checkbox values to local storage

Post by Serhii Kulibaba »

Sorry, but I didn't get your point. As I see on the screnshot it displays exactly the value, which you send to the label: Image

What values do you want to get on these labels? Could you please provide us with exact value

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Save checkbox values to local storage

Post by Ellen Schlechter »

You are correct. Everything is fine in local storage. But now I am on to the next step and I am trying to break it apart. My result is in the console now instead of in storage. Image

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Save checkbox values to local storage

Post by Ellen Schlechter »

Has anyone had a chance to take a look at this?

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

Save checkbox values to local storage

Post by Serhii Kulibaba »

Sorry, but it is not clear for me. What exactly do you need to do with these values? What is wrong with them? Please show us the exact screen you need to get

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Save checkbox values to local storage

Post by Ellen Schlechter »

Okay, so with the current implementation as outlined above, the console.log shows the result of: pre arrayJS = 58d82049a428932046b19ca5 /pre

If you look at the screenshot of the what is on the device, there are two rows in the grid with two unique ids. In that case, I want both ids to show up in the console via mapping like such: pre arrayJS = 58d82049a428932046b19ca5, 58d8205aa428932046b19ca7/pre

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

Save checkbox values to local storage

Post by Serhii Kulibaba »

Please make a loop through all array items here, and save a value of the exact property into the arrayJS. E.g.:prevar arrayJS = [];
for(var i = 0; i < myArray&#46;length;i++){
arrayJS&#46;push(myArray["A"]);
}/pre
it saves all properties "A" of tyhe array "myArray" into the variable "arrayJS"

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Save checkbox values to local storage

Post by Ellen Schlechter »

What should myArray be because it returns undefined right now?

Serhii Kulibaba
Posts: 147
Joined: Tue Aug 27, 2013 1:47 pm

Save checkbox values to local storage

Post by Serhii Kulibaba »

This is the abstract example where each item of the array "myArray" has a property "A"

Post Reply