@a6ftcruton wrote:
I'm wondering what current opinions are as to what part of the app should handle simple validations. As an example, think of a todo app that has an input field. The user should not be able to submit an empty string.
I'm not asking how to validate, but where in an ember app with no defined controllers validations belong (and why).
On one hand, it seems to make sense to recognize that the input is blank and stop it right there at the component level, capturing the action before submitting sending the action to the route. On the other hand, it seems like an attribute on a record (a todo record in this case) should be the concern of the model itself and therefore should be checked at the route level before submitting it to the server.
While it's also possible to hand it all off to the server and let your backend handle validations, a trip across the wire in this case seems silly.
Would love to hear different opinions and reasoning for where this type of validation logic belongs.
Posts: 1
Participants: 1