Page 1 of 1

how to cancel a toggle change via javascript

Posted: Thu Apr 02, 2015 10:18 pm
by conor roche

on click/press of a toggle i want to make an api call and only if it succeeds have the toggle change state, i can only seem to get javascript events to execute for the value change event and that is too late as the toggle has moved. any ideas?


how to cancel a toggle change via javascript

Posted: Fri Apr 03, 2015 11:47 am
by Egor Kotov6832188

Hello Conor,

Unfortunately, you can prevent this event. You can make toggle component disable track click event, call your service and then make it enable on success event from service change toggle state.