Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Parsing my data ... I cannot get Appery to display what the User has chosen...

Alex,

I see you have changed some variable names from origin.

And that's why you have this problem.

I've fixed it and here work code:

pre

var checkedItemz = [];
//Note you need replace "mobilecheckboxgroup_38" with your checkboxlist component name.
var checkedItemElements = jQuery('[dsid="checkboxgroup"] input[type="checkbox"]:checked');
//Iterate through checked items.
for(var i = 0; i < checkedItemElements&#46;length; i++){
var checkedItem = jQuery(checkedItemElements);
var checkedText = checkedItem&#46;closest("span")&#46;find("label")&#46;text();
var checkedValue = checkedItem&#46;val();
&#47;&#47;Just out this value to browser console&#46; Please check out it to see results&#46;
console&#46;log("checkedItem[" + i + "] = " + checkedValue);
&#47;&#47;Here you can use "checkedValue" JS variable as you need&#46;
checkedItemz&#46;push({text: checkedText, value: checkedValue});
}
localStorage&#46;setItem("checkedItemsLSV", JSON&#46;stringify(checkedItemz));

var checkedItemsLSVValue = localStorage&#46;getItem("checkedItemsLSV");

var outText = "";
for(var i = 0; i < checkedItemz&#46;length; i++){
outText += checkedItemz&#46;text + " " + checkedItemz&#46;value + "";
}
&#47;&#47;Note you should replace "labelName" with your label name&#46;
Apperyio("label_NGSS")&#46;text(outText);

/pre

Regards.

Alex Van Name
Posts: 0
Joined: Mon Jun 30, 2014 7:36 pm

Parsing my data ... I cannot get Appery to display what the User has chosen...

Yuri, Thank you so much for helping me fix the code. I was unsure about the English grammar of "checked item" vs "checked items"...thanks for helping me.

Return to “Issues”