Wikiki / bulma-steps

Bulma's extension to manage steps
MIT License
96 stars 44 forks source link

How to prevent step from being changed? #27

Open crabnky opened 5 years ago

crabnky commented 5 years ago

Hi,

just before step is changed I want to check some conditions and change step or not. How do I do this? I truied to use beforeNext option and return false if I do not want to change step, but it does not work. Did I miss something?

Thanks

crabnky commented 5 years ago

OK, I figured out that beforeNext callback should return array of errors - than step won't be changed. But now I'm trying to validate form via ajax, and now it seems like step is changed before ajax call returns a response - this is due to async request of course.

mojpe commented 5 years ago

I'm trying to do the same flowing this example but no luck so far. https://github.com/Wikiki/bulma-extensions/issues/20

jeraldpunx commented 5 years ago

Hello, how did you do this?

I am using https://github.com/Wikiki/bulma-extensions/issues/20#issuecomment-357448004 but it gave me "StepsWizard is not defined"

cawalch commented 5 years ago

Looks like dist wasn't updated with the latest changes.

https://github.com/Wikiki/bulma-steps/blob/2eda7e41ab637875a667ab7af87d83ebb571fe21/dist/js/bulma-steps.js#L272

vs

https://github.com/Wikiki/bulma-steps/blob/2eda7e41ab637875a667ab7af87d83ebb571fe21/src/js/index.js#L173

Possible fix