Page 1 of 1

display check boxes values

Posted: Thu Dec 19, 2013 7:01 pm
by Brian Irr

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


display check boxes values

Posted: Thu Dec 19, 2013 8:28 pm
by Kateryna Grynko

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


display check boxes values

Posted: Fri Dec 20, 2013 1:12 pm
by Brian Irr

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?


display check boxes values

Posted: Fri Dec 20, 2013 1:36 pm
by Maryna Brodina

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?


display check boxes values

Posted: Fri Dec 20, 2013 2:17 pm
by Brian Irr

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


display check boxes values

Posted: Fri Dec 20, 2013 4:47 pm
by Kateryna Grynko

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/...