In general, you would define the validators with the model. However, the example below uses SQLFORM.factory, which is not based on an existing model (i.e., DB table definition). In other words, there is no define_table in a model file associated with that particular form creation.
Anthony On Sunday, October 30, 2011 11:21:00 AM UTC-4, Tom Campbell wrote: > > In the building a minimalist facebook <http://vimeo.com/21364178> clone > video at around 7:30 I see this in default.py: > > def search() > # make a form where to type a name > form = SQLFORM.factory(Field('name',requires=IS_NOT_EMPTY())) > > Question about the requires. This no difference between putting the > requires clause there vs. in the define_table() method in the model, > correct? If not is either way considered to be a better web2py convention? > Generally I think I'd like it in the model, and put it in the controller > only where it does something contrary to expected behavior, but I'm a noob. >

