The table definition:

db.define_table('Contact',
    Field('organization',length=128),
    Field('title',length=8),
    Field('givenName',length=32),
    Field('familyName',length=64,default='',notnull=True),
    Field('phone',length=16),
    Field('email',length=128,default='',notnull=True),
    Field('subject',length=128,default='',notnull=True),
    Field('text',type='text',default='',notnull=True),
    Field('createdOn',type='datetime',writable=False,readable=False),
    Field('modifiedOn',type='datetime',writable=False,readable=False),
    Field('repliedOn',type='datetime',writable=False,readable=False),
    migrate=False)


The function:

def contact():
    response.view='generic.html'
    form=SQLFORM(db.Contact,separator='')
    if form.process().accepted:
        response.flash=response.flash_formsuccess
    elif form.errors:
        response.flash=response.flash_formerror
    else:
        response.flash=response.flash_form
    return dict(form=form)


The view, is the generic.html view:

{{extend 'layout.html'}}
{{"""

You should not modify this file. 
It is used as default when a view is not provided for your controllers

"""}}
<h2>{{=' '.join(x.capitalize() for x in request.function.split('_'))}}</h2>
{{if len(response._vars)==1:}}
{{=BEAUTIFY(response._vars.values()[0])}}
{{elif len(response._vars)>1:}}
{{=BEAUTIFY(response._vars)}}
{{pass}}
{{if request.is_local:}}
{{=response.toolbar()}}
{{pass}}

{{=form.custom.begin}}

{{#<!-- Add header here -->}}
{{=form.element('table')}}

{{#<!-- Add footer here -->}}
{{=DIV(form.custom.end[1] # hidden field}}

{{#<!-- Add submit/cancel buttons here - you may even not use the submit 
variable -->}}
{{=form.custom.end[0] # </form>}}


I hope I provided sufficient information to solve the problem.

Kind regards,

Annet

Reply via email to