Thanks for your help LightDot. It's nice to be pointed in direction after
several days of getting nothing done.
One question on hidden fields that I'm missing -- as I have everything
working except for hiding the field from the user.
<Model>
db.define_table('table',
Field('field_hidden', 'string'),
Field('field_not_hidden', 'string'))
<Controller>
grid = SQLGRID
If request.args(0) in ['new]:
response.view = 'default/custom_edit.html'
form = SQLFORM(db.table, hidden={'field_hidden':0})
forms.vars.field_hidden = request.vars.field_hidden
if form.process(onvalidation=form_validation).accepted:
redirect to appropriate page
def form_validation(form):
modify form.vars as needed
form.accepted = True
Everything works except I am unable to hide the field 'field_hidden' on the
customer SQLFORM with the hidden attribute (hidden={'field_hidden':0}). The
field is just shown as normal. Triple checked the field spelling, etc.
If I use db.table.field_hidden.readable, .writable = False, it is not
shown, but I am then unable to change the field values in the
form_validation function...
Not sure what I'm missing with the hidden syntax.... Any help is
appreciated.
On Friday, February 7, 2014 8:43:19 AM UTC-6, A36_Marty wrote:
>
> I'm stumped. Have tried this with the grid, custom forms, etc.
>
> Could someone advise how to achieve the questions highlighted below - or -
> if it can't be done with a grid, how to achieve it?
>
> db.define_table('table',
> Field('field_hidden', 'string'),
> Field('field_not_hidden', 'string'))
>
> *def index():*
>
> Question: Code to hide 'field_hidden' to user but still make it
> available in the validate_grid function?
>
> grid = SQLFORM.grid(table, onvalidation=validate_grid)
>
> return grid
>
> *def validate_grid(form):*
>
> Question: Code to be able to modify 'field_hidden' here & have it
> written to the database?
>
> form.accepted = True
>
>
--
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/groups/opt_out.