Page 1 of 1

How can I set the state of a Toggle UI component to 'on' using Javascript? The example in the docs does not seem to work

Posted: Fri May 15, 2015 8:43 pm
by Todd Penny

Here's my code:

if ( remlogin === true){ //If remember login was set last time

Apperyio("saveLoginToggle").val("on");
Apperyio("saveLoginToggle").flipswitch("refresh");
...
}

Where saveLoginToggle is the name of my toggle componment with values of 'on' and 'off'


How can I set the state of a Toggle UI component to 'on' using Javascript? The example in the docs does not seem to work

Posted: Sat May 16, 2015 12:03 pm
by Serhii Kulibaba

Hello Todd,

Please use JS below:

Apperyio("saveLoginToggle").val("off").flipswitch("refresh");


How can I set the state of a Toggle UI component to 'on' using Javascript? The example in the docs does not seem to work

Posted: Sat May 16, 2015 12:49 pm
by Todd Penny

I tried this and it did not work. I have attached a screen shot showing the error.

Uncaught TypeError: Apperyio(...).val(...).flipswitch is not a function

Image


How can I set the state of a Toggle UI component to 'on' using Javascript? The example in the docs does not seem to work

Posted: Sat May 16, 2015 2:36 pm
by Illya Stepanov

Hi Todd -

Could you please provide us with a public app link and steps to reproduce.


How can I set the state of a Toggle UI component to 'on' using Javascript? The example in the docs does not seem to work

Posted: Sat May 16, 2015 5:48 pm
by Todd Penny

Sure. Here's the link. http://appery.io/app/mobile-frame?src...

To reproduce, just start the app and login the first time using the default login credentials and also slide the toggle to 'on' to remember password. The restart the app and it should freeze straight away. You can check the onload event for the page to see the JS code.


How can I set the state of a Toggle UI component to 'on' using Javascript? The example in the docs does not seem to work

Posted: Sat May 16, 2015 5:50 pm
by Todd Penny

Strangly, I only see the error when trying to set the toggle to 'on'?


How can I set the state of a Toggle UI component to 'on' using Javascript? The example in the docs does not seem to work

Posted: Tue May 26, 2015 12:46 pm
by Serhii Kulibaba

There is error "User transformation function exception. Reason: AppSettings is not defined" Where do you define AppSettings variable?