outstanding issue 2
outstanding issue 2
Hi John,
[quote:]I need to retrieve, what is the API to do that?[/quote]There is no such API. Run the following JS code: codeAppery("mobileselectmenuName").val().length/code
[quote:]I cant seem to set the value of a localStorage into the selected menu.[/quote]To do this you would need to use JavaScript. Go through the List of items and mark them in list.
How do you save checked items in localStorage?
ok well for example i tried to alert me the value and doesnt do anything like this:
----------------------------------------------------var input = Appery("mobileselectmenuName").val().length;
alert (input.val());
Firebug says: 'TypeError: input.val is not a function'
storing into localstorage works:
---------------------------------------------------var a = Appery("interests_music").val().length;
localStorage.setItem('total_music_interests', a)
but not alerting the value of the component
how about outstanding issue 2? how do i make that work?
John,
codevar input = Appery("mobileselectmenuName").val().length/code
This code returns a number. A number doesn't have val() method. This code returns length of a string or an array.
how about outstanding issue 2? I havent got a response yet on that?
uhmm i even tried this JS and doesnt do anything:
------------------------------------------------------------------------------------------------Appery( "mobileselectmenuName" ).val( localStorage.getItem( "interest_music" ) );
------------------------------------------------------------------------------------------------so, how do i populate the select menu with the items in local storage? to clarify, a predefined list is already there, i just need to have the appropiate items checked according to what is in local storage (in this example)??
Hello! To save to localStorage variable all checked values use:
codelocalStorage.setItem("interests_music", JSON.stringify(Appery("interests_music").val()));/code
to retrieve values from localStorage variable code
var selectedValues;
try {
selectedValues = JSON.parse(localStorage.getItem("interests_music"));
if ({}.toString.call(selectedValues) !== "[object Array]") {
selectedValues = [];
}
} catch ( e ) {
selectedValues = [];
}
Appery("interests_music").find("option").each(function() {
var $this = $(this)
if (selectedValues.indexOf($this.prop("value")) != -1) {
$this.prop("selected", true);
} else {
$this.prop("selected", false);
}
})
Appery("interests_music").selectmenu("refresh");/code
where interests_music - name of select with multiple selection enabled
thank you, this is exactly what i was looking for