Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acept Promise on return of "leaveStep" event. #47

Closed
albertoVieiraNeto opened this issue Mar 23, 2018 · 8 comments
Closed

Acept Promise on return of "leaveStep" event. #47

albertoVieiraNeto opened this issue Mar 23, 2018 · 8 comments

Comments

@albertoVieiraNeto
Copy link

albertoVieiraNeto commented Mar 23, 2018

hi.

I think the plugin is awsome, but there still some points of inprovement. for example i would like to be able to have the ability to return a jquery promise or a native promise on the leaveStep event:

Can i make the necessary modifications and make a pull-request?

currently i'm using something similar to this: #20

Example:

$("#smartwizard").on("leaveStep", function (e, anchorObject, stepNumber, stepDirection) {
	
	//we could have a jquery ajax or something else here
	return new Promise(function(resolve, reject){ resolve(true)})

})
@techlab
Copy link
Owner

techlab commented Mar 27, 2018

Hi @albertoVieiraNeto
It is a great idea you come up with, please feel free to make the pull request to dev branch. Thank you so much.

@nusoft
Copy link

nusoft commented Dec 14, 2018

@albertoVieiraNeto Did you manage to get this working with a Promise?

@michaelpev
Copy link

Hi guys, I am REALLY keen to see this implemented; I am attempting to get SmartWizard working with AJAX, & none of the suggested workarounds are able to do what I need. I am willing to discuss paying you for your time to get this sorted - please feel free to reach out to me

@michaelpev
Copy link

I am using SmartWizard in an ASP .Net core MVC application, & want to use View Components (like partial views) and AJAX for each step in my wizard. In order to do server side validation, AJAX is required to return validation events (e.g. if form doesnt validate, AJAX function returns validation messages, & does not allow you to move to next step; if successful, move to next step

@techlab
Copy link
Owner

techlab commented May 23, 2020

Thank you again @albertoVieiraNeto for the suggestion, this is implemented in the new version of jQuery Smart Wizard v5 #87

The ajax content can be loaded via an event stepContent with the help of Promise.

Read more about the implementation http://techlaboratory.net/jquery-smartwizard#ajax_contents
Ajax example page http://techlaboratory.net/projects/demo/jquery-smart-wizard/v5/ajax

cc @nusoft @michaelpev

@techlab techlab closed this as completed May 23, 2020
@chobo2
Copy link

chobo2 commented Aug 10, 2020

Thank you again @albertoVieiraNeto for the suggestion, this is implemented in the new version of jQuery Smart Wizard v5 #87

The ajax content can be loaded via an event stepContent with the help of Promise.

Read more about the implementation http://techlaboratory.net/jquery-smartwizard#ajax_contents
Ajax example page http://techlaboratory.net/projects/demo/jquery-smart-wizard/v5/ajax

cc @nusoft @michaelpev

How about "LeaveStep" does that support promises? I have the same problem as @michaelpev as I need to do server side validation and bring back the results. If validation fails I don't want to leave that step. If I do this validation in "StepContent" the wizard has already visually moved to the next step which I don't want.

@techlab
Copy link
Owner

techlab commented Aug 11, 2020

@chobo2 I get that point with the "LeaveStep" to accept promises, I will look into the possibility of include it on the next versions.
In the mean time, there is already a workaround to handle the case, please refer #20

@chobo2
Copy link

chobo2 commented Aug 11, 2020

@chobo2 I get that point with the "LeaveStep" to accept promises, I will look into the possibility of include it on the next versions.
In the mean time, there is already a workaround to handle the case, please refer #20

Yep, that is what I implemented but think a promise way would be cleaner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants