Hi folks,
I'm trying to insert additional field to DB, but it cannot be obtain from
SQLFORM.
I use SOLIDGRID
plugin
http://dev.s-cubism.com/plugin_solidgrid?_signature=868375a5ca48f87805d4366b05a2df678637611e
For my purposes I define a table
db.define_table('r_users',
db.Field('username', 'string', requires=IS_NOT_EMPTY(),
length=128, required=True),
db.Field('registered', 'boolean', required=True,
default=False),
db.Field('email', 'string', requires =
IS_EMAIL(error_message='invalid email!'),
length=64, required=True),
db.Field('password', 'string', requires=IS_NOT_EMPTY(),
length=255, required=True),
db.Field('ip', 'string', requires = IS_IPV4(),
required=False, default='127.0.0.1'),
db.Field('modified_on', 'datetime', required=True),
db.Field('captcha_url', 'string', length=255,
required=True),
migrate='r_users.table', fake_migrate=fake_migrate)
and add to plugin code invalidation method to calculate field that I cannot
obtain from form (add to line 298):
def __onvalidation(form):
rs = self.callback(request.post_vars)
print request.post_vars
if rs.startswith('http'):
request.post_vars['captcha_url'] = rs
and assign this in the line 429
create_form = SOLIDFORM(virtualtable or table,
fields=create if type(create) in (list, tuple) else
None,
showid=showid,
_class='web2py_form',
submit_button=T('Create'),
).process( # next=referrer, for web2py-bug
*onvalidation=__onvalidation,*
onsuccess=oncreate,
formname=formname)
This method added captcha_url field to request.post_vars successfully. But
in DB there is no value.
This is the common problem, not only using this plug-in. I cannot do this
trick while using SQLFORM only, without plug-in.
What I'm doing wrong?
Thanks.
--
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.