Package gluon :: Module sqlhtml :: Class SQLFORM
[hide private]
[frames] | no frames]

Class SQLFORM

source code

object --+        
         |        
  html.DIV --+    
             |    
     html.FORM --+
                 |
                SQLFORM


SQLFORM is used to map a table (and a current record) into an HTML form

given a SQLTable stored in db.table

SQLFORM(db.table) generates an insert form
record=db(db.table.id==some_id).select()[0]
SQLFORM(db.table,record) generates an update form
SQLFORM(db.table,record,deletable=True) generates an update 
                                        with a delete button

optional arguments:

fields: a list of fields that should be placed in the form, default is all.
labels: a dictionary with labels for each field. keys are field names.
linkto: the URL of a controller/function to access referencedby records
        see controller appadmin.py for examples
upload: the URL of a controller/function to download an uploaded file
        see controller appadmin.py for examples
any named optional attribute is passed to the <form> tag
        for example _class, _id, _style, _action,_method, etc.

Instance Methods [hide private]
 
__init__()
SQLFORM(db.table,...
source code
 
accepts(self, vars, session=None, formname=None, keepvalues=False)
same as FORM.accepts but also does insert, update or delete in SQLDB
source code

Inherited from html.FORM: postprocessing, xml

Inherited from html.DIV: __str__, rec_accepts, rec_clear

Inherited from html.DIV (private): _xml

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__

Class Variables [hide private]

Inherited from html.FORM: tag

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__()
(Constructor)

source code 

SQLFORM(db.table,
       record=None,
       fields=['name'],
       labels={'name':'Your name'},
       linkto=ULR(r=request,f='table/db/')

Overrides: html.DIV.__init__

accepts(self, vars, session=None, formname=None, keepvalues=False)

source code 

same as FORM.accepts but also does insert, update or delete in SQLDB

Overrides: html.DIV.accepts