I like the conciseness of how Massimo does this: db.student.student_name.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB (db,"student.student_name")]
On May 3, 12:29 am, Jason Brower <[email protected]> wrote: > Wow, thanks Yarko. > > > > On Sat, 2009-05-02 at 16:25 -0500, Yarko Tymciurak wrote: > > Also, note, that you are trying to combine two FORM validators. > > > Since the first requirement belongs on the DAL / on db checking, so > > the database can raise an error, then your second requirement is > > _clearly_ (correct?) a form validator: you want the form to not be > > accepted if it is submitted without a name... > > > So you mean is more clearly said like this: > > > db.define_table('student', > > SQLField('student_name', 'string', uniq=True), > > .... > > > Since you probably don't want student name dropdown boxes in the form, > > then this will work: > > > db.student.student_name.requires = > > [ IS_NOT_IN_DB(db,"student.student_name") ] > > .... > > db.student.student_name.requires.append( IS_NOT_EMPTY() ) > > > Regards, > > - Yarko > > > On Sat, May 2, 2009 at 12:22 PM, Jason Brower <[email protected]> > > wrote: > > > And that dunce light points at Encompass. > > Thanks! > > Jason > > > On Sat, 2009-05-02 at 09:13 -0700, DenesL wrote: > > > You are redefining the requires for student_name: > > > > On May 2, 10:21 am, Jason Brower <[email protected]> > > wrote: > > > > db.student.student_name.requires = IS_NOT_IN_DB(db, > > > > "student.student_name") > > > ... > > > > db.student.student_name.requires = IS_NOT_EMPTY()- Hide quoted > > text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

