Thank you for understanding me :)
I tried but this code will set the default value if the field exist on
the view.
I made a simple example. I don't want to show field2 so it's excluded
in view using custom form but want to store the value like 'BBB' or
'CCC' before it's inserted into table. This code just leave field2
blank...
model
------------------------
db.define_table('mytable',
Field('field1'),
Field('field2'))
controller
------------------------
def index():
form = SQLFORM(db.mytable)
form.vars.field2 = 'BBB'
if form.process().accepted:
form.vars.field2 = 'CCC'
session.flash = 'form accepted'
redirect(URL('index'))
elif form.errors:
response.flash = 'form has errors'
return dict(form=form)
view
------------------------
{{extend 'layout.html'}}
{{=form.custom.begin}}
Field1: {{=form.custom.widget.field1}}
{{=form.custom.submit}}
{{=form.custom.end}}
On Nov 1, 6:58 pm, pbreit <[email protected]> wrote:
> I believe in your controller, before form.process() (or form.accepts),
> include:
>
> form.vars.FFTSCD = 'aaa'