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

Change words on toggle component

Can you post a screen shot of your mapping?

Andrés Méndez
Posts: 0
Joined: Thu Apr 18, 2013 6:13 pm

Change words on toggle component

Hello Max.

My app is shared with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a, so you can see the entire app.

The code of this problem is in the page "Lista_Regalos".

Thanks.

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

Change words on toggle component

Service JSON:

Image

Service mapping:

Image

JavaScript:

Image

Result:

Image

Andrés Méndez
Posts: 0
Joined: Thu Apr 18, 2013 6:13 pm

Change words on toggle component

Hello Max.

Thanks for the good explanation, but that part already works for me, but there is not my problem, my problem is to show not "On" or "Off" in a toggle but, for example, "Enabled" or "Disabled" (or "Yes" and "No" as Michael originally asked).

That's what I haven't been able to make it work, to show different words than "On" or "Off".

Thanks.

Oleg Danchenkov
Posts: 0
Joined: Tue Apr 30, 2013 5:51 pm

Change words on toggle component

Hi Andrés.
Try this code in mapping to toggle element
codeelement.parent().find(".ui-slider-label-a").text("Disabled");
element.parent().find(".ui-slider-label-b").text("Enabled");
var toggleValue = (value ? "on" : "off");
element.val(toggleValue).refresh();
return true;
/code
This code changes labels on toggle element. Values still will be "on/off"

Andrés Méndez
Posts: 0
Joined: Thu Apr 18, 2013 6:13 pm

Change words on toggle component

That's it Oleg, now it works!

My fault was that I was using the code of
codeelement.parent().find(".ui-slider-label-a").text("Disabled");
element.parent().find(".ui-slider-label-b").text("Enabled");/code
in page load, not in the JSON mapping.

Thanks for your solution!

Return to “Issues”