> 1. How to enable/disable Steps (and prev/next buttons) depending on
> validation results of the form in a current step? Particularly, I'm trying to
> understand if it's possible to bind a validation function to step enablement
> property
A possible approach: keep the "valid-state" of each component in a map, along
with data which view is currently showing.
Atom for a specific wizard instance:
(def wizard-state {:showing :foo
:panel-states {:foo false
:bar false}}
Then each component can provide a callback by which the wizard can determine
the validity of the currently showing component:
[wizard menu-state
{:id :foo :title "Foo" :component [foo-panel] :callback (fn []
(foo-valid?))}
{:id :bar :title "Bar" :component [bar-panel] :callback (fn []
(bar-valid?)}]
foo-valid? would be a specific function for the foo panel, like
(and (seq (-> @foo-state :field1)) (seq (-> @foo-state :field2)))
> 2. How to bind "next/previous" buttons state to "steps" state? For example,
> for the 1st step "Previous" button should not be visible.
This logic should be encoded in the wizard, if the wizard is responsible for
showing the previous or next button. It it is rendering the first element,
disable previous. If the current showing panel is not valid (according to
callback) or if showing the last panel, disable next.
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.