Hi! Liking the UI that the new Wizard control gives us. We'd like to run some code when a user hits the next button (that will affect the controls in the following step in the wizard).
Are there events that we can hook when the next/prev buttons are clicked? If not, how would be specifically hook the click event on the next button within that control?
Is there a way to get the target step when the update:startIndex event is raised? I need to do certain validation but only applies for the next step from the current, not to the previous.
You can use the code below to check if a user moved to the next step of Wizard container:
fd.container("Wizard0").widget.$on("update:startIndex", function() {
var previousTabIndex = fd.container("Wizard0").widget.activeTabIndex;
window.setTimeout(function() {
var currentTabIndex = fd.container("Wizard0").widget.activeTabIndex;
//check that this is the next step
if(currentTabIndex > previousTabIndex) {
//do something here
}
}
, 100)
})
That worked perfectly but i have another question:
How does one access to the validation that happens on each step?
In my form, in the first step, I have a List or Library control and I need the user to select exactly one item.
I would also like to prevent the user to select more than one item but i couldnt find any event neither. Any ideas?
Thanks!
Figured out the second of my questions by adding a watcher to the selectedItems property of the control:
control.$watch('selectedItems', function(items){...})
Still couldnt figure out how to get to the validation performed on each step tho
Hi @mnikitina, thanks for your reply. Yep, I added the validator to the List or Library control and it didnt work. However, I found a not-that-elegant way to do that.
I added a common field in the form, then added a validator for that field that checks on the control I want to validate (in my case, that the list or library control has one selectedItem). Then I hide the container for that common field via CSS.
I am searching for the previousTab function for a Wizard container?! fd.container('Wizard').widget.nextTab(); works like a charm, but fd.container('Wizard').widget.previousTab(); not.