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
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
Hi Michael,
You can try to map your toggle direct to the request parameter in the mapping, to avoid any coding
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
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
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")
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
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
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.
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.
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.length; ind++ ){
result.push($(".ui-flipswitch-input option[value="+Apperyio(names[ind]).val()+"]").text())
}
// set your LSV from temp result array
Apperyio.storage.MY_LSV.set(result);
// NOW YOU CAN MAP YOUR LSV/pre
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