-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
Prevent validation when schema has changed and form is not submitted #82
Comments
I think in ValidatedForm.componentWillReceiveProps the same logic as in onChange should apply:
but componentWillReceiveProps does also sets state.validated and i don't know why yet, can you guys help? |
Yes, you are completely right @macrozone - just wrap |
YOU - ARE - AWESOME! many thanks @radekmie ! Works like a charm ___ Btw. I created i18n_service for mantra that wraps meteor-universe-i18n and provides some convenience functions for mantra-apps. It's still rough, but works perferctly so far and i like to share: https://gist.github.com/macrozone/f1ab1bf6f205f5bfb7518bac0d2854d5 It's meant to be initalized in the context in mantra app. It has a function translateSchema, that translates a simpleSchema. It automatically sets labels by it's field name and the given namespace. It also defines a default universe.transform-function that can translate allowedValues. It's meant to be used in a container:
Then in your locale-yamls:
Without this PR here, the form would validate on every language change. Now you can change locale even in the middle of filling out a form :-) Maybe we can integrate something similar in universe-i18n or release a npm package for this (meteor dependencies will be injected) |
Wow, just wow! And as to i18n - if you like, go ahead, create an PR - we'll see, if it makes sense to create a separate package. Looking forward your progress! |
validate=onChangeAfterSubmit or validate=onSubmit should prevent validation unless the user has submitted the form for the first time.
If you update the schema, this option is ignored and the form is validated.
Updating the schema is valid, e.g. if you have options from a collection that you define on the schema or if you translate the schema.
I'll check if I can do a PR.
The text was updated successfully, but these errors were encountered: