• 969 views
  • 0 comments
  • loading...

Create record

Create records using CRUD

crud.create(table, next, onvalidation, onaccept, log, message)


Attributes / Arguments

 DAL table or a tablename the method should act on


The onvalidation argument can be None or can be a function that takes the form and returns nothing. Such a function would be called and passed the form, immediately after validation (if validation passes) and before anything else happens. This function has multiple purposes: for example, to perform additional checks on the form and eventually add errors to the form, or to compute the values of some fields based on the values of other fields, or to trigger some action before a record is created/updated.

onaccept is a function to be called after the form submission is accepted and acted upon, but before redirection.

log is the log message. Log messages in CRUD see variables in the form.vars dictionary such as "%(id)s".

message is the flash message upon form acceptance.


Examples

loading...

Sources / Reference

" web2py Book Chapter 7: Forms and Validatators" is licensed under Creative Common License BY-NC-ND 3.0


Comments

loading...

Powered by
Web2py

Hosted on
www.pythonanywhere.com
(affiliated link)