Hi,
I am experiencing form submission is occasionally not working. There is no
error whatsoever, form entries get cleared.
It seems to getting better with cache disabled, but maybe it's just an
impression.
model:
db.define_table('teilnehmer',
Field('vorname', label=T('Name')),
Field('name', label=T('Surname*')),
Field('email', label='E-Mail*'),
Field('address', label=T('Street/Number')),
Field('city', label=T('Postcode/City')),
Field('newsletter', 'boolean', default=False, label=T('Please subscribe
me for your Newsletter')),
Field('beitrag', label= 'Zugehöriger Beitrag'),
Field('projektid'),
Field('results','text', label='Ergebnisse'),
singular="Formularteilnehmer", plural="Formularteilnehmer",
format = '%(email)s')
db.teilnehmer.email.requires = IS_EMAIL(error_message=T('Please use a valid
e-mail address'))
controller:
#@cache.action(time_expire=1000, cache_model=cache.ram, public=True)
def teilnahme():
'''lines = db(db.projekt.projektid==request.args(1)).select().first()'''
projekt = db(db.projekt.projektid==request.args(0)).select().first()
if (projekt.bgshade == 'hintergrund_dunkel'):
headlinecolor= "black"
else:
headlinecolor=""
bgshade=projekt.bgshade or ''
ivw = request.args(5) or ''
felder= ['vorname', 'name', 'email','address','city']
if projekt.newsletter is True:
felder.append('newsletter')
form= SQLFORM(db.teilnehmer, fields = felder,showid = False)
form.vars.beitrag = request.args(2)
form.vars.projektid = request.args(0)
form.vars.results = str(request.args(3))+' von '+str(request.args(1))
my_extra_element = DIV(DIV(DIV(LABEL(INPUT(_name='agree',value=False,
_type='checkbox',requires=IS_NOT_EMPTY(error_message=T('Please agree to the
terms and conditions'))), XML(T('I have read the')+' <u>'+str(A(T('terms
and conditions '),
_href='/'+request.application+'/'+request.controller+'/meta.load/1/terms',
cid='wuerg'))+'</u>'+T('and the')+' <u>'+str(A(T('data protection '),
_href='/'+request.application+'/'+request.controller+'/meta.load/1/daten',
cid='wuerg'))+'</u>'+T('statement and agree with them')+'* ')),
_class='checkbox'), _class='col-sm-offset-3 col-sm-9'), _class='form-group
terms')
form[0].insert(-1,my_extra_element)
if form.process().accepted:
redirect(URL('kampagne', args=[projekt.projektid,'000',ivw],
vars=dict(flash='flash')))
view:
...
<div><h2>{{=T('Participation')}}</h2></div>
<div class="..."> {{=form}}</div>
...
Any hints would help a lot
- Stephan
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.