-
Notifications
You must be signed in to change notification settings - Fork 300
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
Can you bind multiple views to the same model? #227
Comments
I have done this in the past. Don't bind directly to the view but use the mixin on the model instead. |
Thanks for the reply. So then you just listen for the |
Yep, you can just have your view listenTo the validated events on the model, then wire up your UI interactions that way. We ended up need something a little bit more robust so we actual manually call the preValidation method on the model for what we are trying to validate (because we are doing real-time validation) and then we do whatever we need based on valid/invalid. I might also suggest making some sort of view mixin so that you can mixin in that with any view you need to handle model validation. |
Sounds good, thanks for the rundown. For clarification on one point, I thought |
I'm using Marionette, but it shouldn't make a difference as far as this question.
I have two views, a
LoginView
and aSignupView
(both forms). They are shown at the same time, and instantiated with an empty User model, eg:each of those views is doing
but only the SignupView is seeing the validation effects. Is there a way to have the model validation affect both views, or am I going to have to send them each a separate Model instance?
Thanks for the awesome plugin!
The text was updated successfully, but these errors were encountered: