Page 1 of 1

reading toggle value

Posted: Fri Feb 15, 2013 11:54 am
by Michael4771079

Hi,
I am using this code to change the text on toggle

codeTiggzi("texttoggle").parent().find(".ui-slider-label-a").text("Yes");
Tiggzi("texttoggle").parent().find(".ui-slider-label-b").text("No");/code

all works very well

I need to read the value of the toggle in and include it in an email, this is the code I am using in data mapping to read values in the email

I am unsure if the code to read the toggle is correct because it returns the value of "on and off"
rather than "yes and no" that has been change with the css

codevar name = localStorage.getItem("_name") + "\n";

var mobile = localStorage.getItem("_mobile") + "\n";

var pickupvalue = Tiggzi('fromselectmenu').val() + "\n";

var destinationvalue = Tiggzi('toselectmenu').val() + "\n";

var timevalue = Tiggzi('timeselect').val() + "\n";

var datevalue = $('input:eq(5)').val() + "\n";

var passangervalue = Tiggzi('passangerselect').val() + "\n";

var textvalue = Tiggzi('texttoggle').val() + "\n";

return " Name: " + name + " "+ "Mobile Number: " + mobile + " "+ "Pick Up From: " + pickupvalue + " "+ "Destination: " + destinationvalue + "Date: "+ datevalue + " "+ "Time: " + timevalue + " "+ "Passangers: " + passangervalue + " "+ "Text Back: " + textvalue + " ";code/code/code


reading toggle value

Posted: Fri Feb 15, 2013 2:29 pm
by maxkatz

You are probably reading off the label, not the actual value. Try using a different selector to get the value of the component.


reading toggle value

Posted: Fri Feb 15, 2013 2:29 pm
by Maryna Brodina

Hi:)

Instead of this code

codeTiggzi("texttoggle").parent().find(".ui-slider-label-a").text("Yes");
Tiggzi("texttoggle").parent().find(".ui-slider-label-b").text("No");/code

use this codeTiggzi("texttoggle").empty().append("<option value='no' >No</option><option value='yes'>Yes</option>").slider('refresh');
Tiggzi("texttoggle")&#46;parent()&#46;find("&#46;ui-slider-label-a")&#46;text("Yes");
Tiggzi("texttoggle")&#46;parent()&#46;find("&#46;ui-slider-label-b")&#46;text("No");/code


reading toggle value

Posted: Fri Feb 15, 2013 3:48 pm
by Michael4771079

thanks Marina,
but the result is now "null"


reading toggle value

Posted: Fri Feb 15, 2013 4:06 pm
by Michael4771079

Cheers Max,

I think I have the right selector as the code above gives me the label "text back" and value "on and off" it reads the original value of component and not the css adjusted value of "yes and no"?


reading toggle value

Posted: Fri Feb 15, 2013 5:15 pm
by Kateryna Grynko

Hello,
We can't reproduce. Could you share the app with support@tiggzi.com?


reading toggle value

Posted: Fri Feb 15, 2013 5:30 pm
by Michael4771079

Thanks Katya,
its shared,

app is currently using Marina's code, gives value as null, with other code, value is original "on and off" and not the css adjusted "yes and no"

hope this helps


reading toggle value

Posted: Fri Feb 15, 2013 6:47 pm
by Kateryna Grynko

On "Book" page, there is the following Run JavaScript action:codeTiggzi("texttoggle")&#46;empty()&#46;append("NoYes")&#46;slider('refresh');
Tiggzi("texttoggle")&#46;parent()&#46;find("&#46;ui-slider-label-a")&#46;text("Yes");
Tiggzi("texttoggle")&#46;parent()&#46;find("&#46;ui-slider-label-b")&#46;text("No");/code
You should change first string to:codeTiggzi("texttoggle")&#46;empty()&#46;append("<option value='no' >No<&#47;option><option value='yes'>Yes<&#47;option>")&#46;slider('refresh');/code


reading toggle value

Posted: Fri Feb 15, 2013 7:00 pm
by Michael4771079

Really cool Katya,

hope you have a good weekend,
I certainly will now!

thanks for all your help