Thanks for your help! I Solved my problem doing this: def processando(form): query = db.inscritos.Oficina =='form.vars.Oficina' if query >=1: form.errors.Oficina = "Oficina esgotada" else: pass def inscrever(): form = SQLFORM(db.inscritos) if form.process(onvalidation=processando).accepted: session.flash = 'record inserted' return dict(form=form)
Reference: http://web2py.com/books/default/chapter/29/07/forms-and-validators#The-process-and-validate-methods Em sábado, 24 de outubro de 2015 22:06:57 UTC-3, 黄祥 escreveu: > > i think you can use the query (count() ) and check condition according to > your need (if query >= value), if condition meet, redirect to another page > redirect(URL(redirect) ), if not insert the data (db.table.insert() ). > > best regards, > stifan > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.