Closed esheri3 closed 8 years ago
@esheri3 I'll look into it and will let you know.
Thanks.
@esheri3 This is confirmed. i'll have to come up with a solution since the onTabShow is triggered when the tab is already shown. I think of updating the readme to state that onTabShow returning false will not prevent tab from showing and just fixing the onTabChange.
Playing with the latest ZIP as of writing it appears that the index parameter value in onTabChange() is always -1. Any chance we can get this bug fixed? Makes it very hard to use this component if you need to do validation before a user changes a tab.
Another idea would be to add an event OnTabChanging() which fires before the tab changes, that way none of the existing code has to change. Returning false there could prevent the change.
@natiki This is still WIP as the tab changing returning false does not prevent the fire of the method. So there needs to be a different solution. You can use the onNext even to do the same thing. and i am not sure what you meant with the last event addition
@VinceG Thanks for the feedback. What I meant was adding a new event called OnTabChanging which fires before the tab has changed as opposed to OnTabChanged which fires after the tab has changed.
If you add this to the life cycle then should a user want to prevent a tab being changed they return false there. Means you can leave the current behaviour (ie not have to do work out how to change back to the original tab when you are on the new tab already in OnTabShow etc.)
@VinceG what you think about pull request #69 ?
@ruionwriting Sorry, haven't tested this yet. i'll try to do it this weekend.
Are there any plans on fixing this? I would love to keep using this with my project, and I would love to help fix it as well, but it's beyond my abilities.
@accomazzo did you test #69 and it didn't work for you either?
Yes that's correct, I even tried using bootstrap 3.0, I am using 3.1.
'return false' does not work. On first tab get -1 index, then afrer clicking tab index gets cached, and on every first click on tab it has old index, on next clicks index is ok, but too late, so event if 'return false' would work, no glory.
Header navbar links are hard to disable, almost uncovered subject in the library.
Just in case anybody else runs into this like I did.
Using a combination of onTabClick
and onNext
I was able to prevent navigating based on validation
@David-Melo : could please create a jsfiddle example ? You can modify this if you like: http://jsfiddle.net/157ttz1p/2/
@digEmAll http://jsfiddle.net/157ttz1p/4/
Here you go, basically I wired every tabchange method to a validator function and pass in the current wizard tab. If the validation for that tab hasn't been met, then navigation is prevented. Hope this helps.
@David-Melo thanks a lot :)
Using the latest code, returning false for onTabClick doesn't work: onTabClick: function(tab, navigation, index) { return false; } It doesn't seem possible to disable tab clicks, which is a problem.
onTabClick: function(tab, navigation, index) { return false; } Is working for me! Only issue I have with onTabClick function is, that my "prev" & "next" button´s CSS is for some reason changed.
Wizard with disabled tab click not working?
http://vadimg.com/twitter-bootstrap-wizard-example/examples/basic-disabletabshow.html
any clue how to fix this?
@gayanc can you try this:
http://vinceg.github.io/twitter-bootstrap-wizard/examples/basic-disabletabclick.html
After an hour of struggle removing data-toggle=tab from the nav actually worked
Returning false in the onTabShow, onTabChange, and onTabClick events does not prevent the wizard from moving onward to the next section. This was tested using the latest version in Github at the time of writing.
Simple Ex:
$('#container .bootstrap-wizard-component').bootstrapWizard({ 'onTabChange': function(tab, navigation, index) { return false; // does not actual cancel tab change } });