I agree. The model shoud validate a form in my opinion using DataAnnotations.
regards, Michel Ank On 7 February 2011 10:00, Jamie Fraser <[email protected]> wrote: > Actually in ASP.Net MVC, the preference / design seems to be to validate > within the Model using DataAnnotations. I don't know if there is any > built-in support for validating within the View. Essentially I don't think > validation should be in the View, because you then have business logic > leaking into the View. Validation belong in the model imo. > > > On Mon, Feb 7, 2011 at 11:46 AM, Benj Nunez <[email protected]> wrote: > >> Hi Karl, >> >> Validation is done usually in the View. >> >> As regards to your inquiry having a no Model in some situation, yes. >> There are some projects (mine included) that does not have a Model. >> >> Take for instance my program that mimics a MySql Query Browser. It >> cannot determine what table fields in advance to have access to, so >> most of the work is done through the Controller. >> >> A model by the way, is simply represented as a class in which you >> outline all the fields that have been defined in a database table. >> >> >> Here are suggested links for you: >> >> http://leepoint.net/notes-java/GUI/structure/40mvc.html >> http://en.wikipedia.org/wiki/Model%E2%80%93View%E2%80%93Controller >> http://www.oracle.com/technetwork/articles/javase/mvc-136693.html >> >> Btw, even though I am a C# user, I still practice what was taught to >> us in Java when it comes to MVC. >> >> Hope the links will help you. Good luck. >> >> >> Regards, >> >> Benj >> >> >> On Jan 14, 6:50 pm, Karl Oakes <[email protected]> wrote: >> > Maybe I am looking at this the wrong way... I'll explain, I have a very >> > simple form with a single input that will require validation. Do I need >> to >> > create a model/viewmodel to represent this model and then setup up a >> > strongly typed view and then use Model validation. Or can I setup view >> with >> > no model, if so where do I validate, the controller, which just seems >> wrong. >> > I think I have answered my own question but would like some advice.. >> > > -- ----------------------------------------------------------------------- Michel G. Ank
