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

reading toggle value

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

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

reading toggle value

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

reading toggle value

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

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

reading toggle value

thanks Marina,
but the result is now "null"

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

reading toggle value

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"?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

reading toggle value

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

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

reading toggle value

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

reading toggle value

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

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

reading toggle value

Really cool Katya,

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

thanks for all your help

Return to “Issues”