Skip to main content

Does something like this work to run code on the ‘tabshow’ and wizard ‘stepchange’ events?


$('body')<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .on('tabshow', function(){<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; component.loadevent();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; })<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .on('stepchange', function(){<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; component.loadevent();<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });


Is there a better way to write that?

Update: This seems to work, but calls loadevent() once for each step of a wizard that has been loaded. When I click to step two, it calls loadevent() twice, when I click to step three, it calls loadevent() three times. Any idea why that would be occurring?


Matt check this out : https://community.skuid.com/t/step-onload-event-or-wizard-onnavigate-event
The key is to add the 2 parameters into your function (e and data). You can just log them to see what information you have access to on every event. Then use some logic to filter out when your actions will run.


Moshe,

Yes, that post is where I found the ‘stepchange’ event to begin with. My initial question was whether I could call ‘stepchange’ from $(‘body’) instead of specifying a jquery selector for the wizard itself (trying to be as generic as possible). That seems to work, although it seems to fire once for each step that has been loaded.


Actually… I figured it out. I’m running this code from a custom component, and I have a different version of the component on each step of the wizard, so it is just running once for each component.

Solved! 🙂


Super!