Robby7162863
Posts: 0
Joined: Sun Oct 12, 2014 7:43 pm

Switchbutton event fires on page load

Hi,

I have a switchbutton from which the value is bind to restservice1. I added a value changed event on the switchbutton to call another restservice2.

In the page onload event I invoke restservice1 but at this moment the value changed event of the switchbutton is triggered. I only want the event triggered when the user clicks on the switchbutton.

I already tried using the click and virtual click event of the switchbutton but this event is not triggered when clicking on the switchbutton ?

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Switchbutton event fires on page load

Hello Robby,

[quote:]which the value is bind to restservice1 [/quote]

Could you please clarify, do you mean that the value of the toggle is set from the results of restservice1?
You can work around this using js. Make some variable flag in localstorage, which will show is the value of toggle established or not (change its value on the load of the page (set it to false) and on the success event of restservice1 (set to true)).
And in the js code check the value of this LSV, before performing any action.

Robby7162863
Posts: 0
Joined: Sun Oct 12, 2014 7:43 pm

Switchbutton event fires on page load

That's what I needed, thx !

Return to “Issues”