Comments (4)
Hey Chris. I'm currently traveling in Europe, but I'll get to this when I get back home.
from jquery-wizard.
I would advise against using a wizard in this way. The wizard was essentially designed for use on a single form, though it will work fine with multiple forms (other than the "submit" function which would submit just the first form in the list). I don't really see the benefit of having so many forms. If your desire is to save the contents of each step before going to the next step, this can be accomplished using AJAX (see the jQuery autosave plugin for an example of this). That said, I could foresee certain scenarios where having multiple forms might be advantageous, so I may consider adding in some extra support for this at a later time.
As for the problem at hand, I believe the .validate()
method will only work on form submission in your example (which is why it only works on the last step). In order to use .valid()
, the .validate()
method would need to be called on each form beforehand. So it seems like you would need a combination of what you have as well as the demo code outlined in issue #5.
Some other things I noticed in the examples above: no need to pass the "options" key into the options hash, it should just be: { steps: ".step" }
-- though that's redundant because it is the default setting. Also, you should probably move the buttons outside of the steps and just place them at the bottom of the wizard, no need to have duplicates.
A final example should look something like this (untested):
$( '#W1' ).wizard({
beforeSelect: function( event, step ) {
return $( state.step ).valid();
}
}).wizard( 'form' ).validate();
from jquery-wizard.
Thanks, Kyle. I followed your suggestion and enclosed all steps in one form (with one set of navigation buttons) to keep things as intended.
I also modified the code above slightly, which seemed to work for me:
$( '#W1' ).wizard({
beforeSelect: function( event, state ) {
return state.step.parent('form').valid();
}
}).validate();
Thank you for your help again.
Chris
from jquery-wizard.
Glad to be of help.
from jquery-wizard.
Related Issues (20)
- Disable Submit Button After Click HOT 1
- Destroy/initiate issue HOT 8
- ignore of validate HOT 1
- Multiple questions require branches
- Branch error messages HOT 1
- Responsiveness Support HOT 4
- Validation doesn't work in presence of labels HOT 2
- How to dynamic create steps HOT 2
- Aync transitions and content HOT 2
- .on not supported in jQuery 1.6 HOT 5
- hide or show step dynamically HOT 2
- History back() support ? HOT 1
- Issue Adding to Wordpress HOT 2
- Reset Wizard? HOT 1
- Question HOT 5
- Input disappeared in multiple nested branches in a single page
- Check for step's controls validity before calculating transition
- How can i skip step ?
- How can I add another submit button for "Save and finish later"
- How can I have 3 working submit buttons with different names? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-wizard.