Ihor Didevych
Posts: 0
Joined: Wed Nov 19, 2014 7:55 pm

upgrade problem saving toggle val

Hi Michael,

You can try to map your toggle direct to the request parameter in the mapping, to avoid any coding

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

upgrade problem saving toggle val

Thanks Ihor,
the values I am using are not in the collection, the code was used to over ride the default values.

This is an upgrade to new builder and I need it to work in the same way as the published app.

Is the no way to over ride the default values of the all the toggles named "thin_deeptoggle" in a grid, in the new builder?

thanks

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

upgrade problem saving toggle val

Hello Michael,

Next lines will change all toggle components values for current screen
pre$(".ui-flipswitch-input option[value=off]").text("Sal")
$(".ui-flipswitch-on").text("Sal")

$(".ui-flipswitch-input option[value=on]").text("Che")
$(".ui-flipswitch-off").text("Chee")/pre

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

upgrade problem saving toggle val

Hi Evegene,
Im afaid this approach wont work as on this page there are 2 toggles, more on other screens, for this reason the code that worked in old builder was specific to the toggle name, i.e "thin_depptoggle"

Here are my results,
I copied the code and ran it on page show, it changes the label on the toggle but not the value.

I altered the code to this but the result is it still the same, it saves the default toggle values "on and off"

$(".ui-flipswitch-input option[value=Chips]").text("Sal")
$(".ui-flipswitch-on").text("Sal")
$(".ui-flipswitch-input option[value=Salad]").text("Che")
$(".ui-flipswitch-off").text("Chee")

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

upgrade problem saving toggle val

Michael,

You can't change value of the toggle, but you can use it to form your result
like this:
preif (Apperyio("mobiletoggle_61").val()) {
}/pre

OR
preconsole.log($(".ui-flipswitch-input option[value="+Apperyio("mobiletoggle_61").val()+"]").text());/pre

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

upgrade problem saving toggle val

Evegene,
do you mean I cannot change the toggle value from "on off" to another value like "chips and salad"

also I dont know where I would use the code above

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

upgrade problem saving toggle val

Hello Michael,
Yes, those values are hard coded, because of styles, classes and other logic in the component initialization, etc.

You can use above code on any events , page hide, before invoke any service - all depends on where you need toggler values.

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

upgrade problem saving toggle val

Hi Egor,

I just need to save a value "chips or salad" for the toggle depending on when it on or off,
the result is saved in an array in LSV and used in an email to send order
this is possible in old builder and works perfectly in published app.

Its very important within this app.
I dont want to upgrade this app but I do not have a choice,
appery wont support the old builder for long and apple will delist app on the 15th because of their requirements.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

upgrade problem saving toggle val

Michael,

Please try this code
pre// save all name in this array
var names = [ "name1", "name2","name3","name4"];

var result = [];
// push each value in temp array
for (var ind = 0 ; ind < names&#46;length; ind++ ){
result&#46;push($("&#46;ui-flipswitch-input option[value="+Apperyio(names[ind])&#46;val()+"]")&#46;text())
}

&#47;&#47; set your LSV from temp result array
Apperyio&#46;storage&#46;MY_LSV&#46;set(result);

&#47;&#47; NOW YOU CAN MAP YOUR LSV/pre

Michael4771079
Posts: 0
Joined: Sat Jul 21, 2012 2:03 pm

upgrade problem saving toggle val

Evegene,
I having trouble understanding this, sorry:(

where to run this code, on page show?

when you say "name1" do you mean the values I want for flipswitch
i.e flipswitch1 "name1 should be Chips and name2 Salad
flipswitch2 "name3 should be Garlic and name4 Chilli

Return to “Issues”