Brian Irr
Posts: 0
Joined: Tue Sep 17, 2013 1:25 pm

display check boxes values

I am looking to display check boxes value in a list. all I am getting is ture.
In my example I have three check boxes (App will have many more)

Egg roll
Spring roll
Spare ribs

I want to display in a list component the values of any or all that are checked off.
All I am getting right now is true. Image

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

display check boxes values

Hi Brian,

Get an array of values:prevar checkbox_arr = Appery("mobilecheckboxgroup_22").find("input");/preThen please check if the element is selected:prevar checked = $(checkbox_arr ).is(":checked");/pre

Brian Irr
Posts: 0
Joined: Tue Sep 17, 2013 1:25 pm

display check boxes values

Would I run the first var code on the "button" (this is the one that sets local storage)
and then the second var on the "post button" (this is the one that sets the property) or do I run them together and DO I still set local property and set property?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

display check boxes values

Hello! Could you please clarify what are you trying to do? User's step by step actions and how do you expect app to work in this case?

Brian Irr
Posts: 0
Joined: Tue Sep 17, 2013 1:25 pm

display check boxes values

this is an Chinese restaurant menu. I will have multiple screens all with check boxes allowing people to order dishes. all of the dishes they order will be listed on a final screen for them to see everything they ordered with the total cost.

As it stands now I have one screen with about 9 check boxes broken up into groups of three. with a "confirm button" that sets local storage and a "place order button" that sets property with the results of "true".

Eventually the place order button and the Your order (list) will be on another screen, but for testing purposes I have them all on one screen. Image

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

display check boxes values

Hi Brian,

To save a value of all the selected page checkboxes in a local storage variable, run the following JavaScript code on button Click event:
prevar checkboxValues = [];
$("input[type='checkbox']:checked", $.mobile.activePage).each(
function(i, el) {
//console.log($(el).val());
checkboxValues.push($(el).val());
});
localStorage.setItem("checkboxValues", JSON.stringify(checkboxValues));/pre
To create a List based on saved localStorage data see this reference please: https://getsatisfaction.com/apperyio/...

Return to “Issues”