I've given up on trying hide a field in the grid yet still be able to see and modify it in the onvalidation route.
I tried for a few hours to achieve the same via custom forms by using hidden={'fieldname':value}. I could see the hidden field in the validation function of the custom form, but couldn't get the value in the storage fields to make it back to the database. (..cut..)
I'm just a hobbyist, trying to learn, but am fast thinking I should just stick to spreadsheets / this is proving to be over my head.
db.define_table('person', Field('name', 'string'), Field('hidden', 'string'))
def index(): form = SQLFORM(db.person, fields=['name'], hidden=dict(hidden="Default hidden text"))
form.vars.hidden = request.vars. if form.process(onvalidation=validate_form).accepted: pass
return dict(form=form)
def validate_form(form):
form.vars.hidden = "Changed hidden text" #Never gets written to database form.accepted = True
db.define_table('person', Field('name', 'string'), Field('hidden', 'string'))
def index(): form = SQLFORM(db.person, hidden=dict(hidden="Default hidden text"))
form.vars.hidden = request.vars. db.define_table('person', Field('name', 'string'), Field('hidden', 'string'))
def index(): form = SQLFORM(db.person, fields=['name'], hidden=dict(hidden="Default hidden text"))
form.vars.hidden = request.vars.db.define_table('person', Field('name', 'string'), Field('hidden', 'string'))
def index():
fields_to_show = db.person.fields fields_to_show.remove('hidden')
form = SQLFORM(db.person, fields= fields_to_show, hidden=dict(hidden="Default hidden text"))
form.vars.hidden = request.vars.Enter code here...db.define_table('person', Field('name', 'string'), Field('hidden', 'string'))
def index():
fields_to_show = db.person.fields[:] fields_to_show.remove('hidden')
form = SQLFORM(db.person, fields= fields_to_show, hidden=dict(hidden="Default hidden text"))
form.vars.hidden = request.vars.Enter code here...db.define_table('person', Field('name', 'string'), Field('hidden', 'string'))
def index(): form = SQLFORM(db.person, fields=['name'], hidden=dict(hidden="Default hidden text"))
form.vars.hidden = request.vars. if form.process(onvalidation=validate_form).accepted: pass
return dict(form=form)
def validate_form(form):
form.vars.hidden = "Changed hidden text" #Never gets written to database form.accepted = Truedb.define_table('person', Field('name', 'string'), Field('hidden', 'string'))
def index(): form = SQLFORM(db.person, fields=['name'], hidden=dict(hidden="Default hidden text"))
form.vars.hidden = request.vars.
form.vars.hidden = "Changed hidden text" #Successfully written to database
if form.process(onvalidation=validate_form).accepted: pass
return dict(form=form)
def validate_form(form):
form.accepted = True