Todd Penny
Posts: 0
Joined: Sun Jan 12, 2014 4:29 pm

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

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'

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

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

Hello Todd,

Please use JS below:

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

Todd Penny
Posts: 0
Joined: Sun Jan 12, 2014 4:29 pm

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

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

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

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

Hi Todd -

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

Todd Penny
Posts: 0
Joined: Sun Jan 12, 2014 4:29 pm

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

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.

Todd Penny
Posts: 0
Joined: Sun Jan 12, 2014 4:29 pm

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

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

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

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

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

Return to “Issues”