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.
Having given up on the custom form route, I'm now trying to simply hide the
field in question using jQuery on the form. i.e.
$("#table_hidden_field__row").hide(), however, the jQuery doesn't select
the element on the document.ready() even though it has a unique id -- maybe
because it is in a component and shown by Ajax / not caught by
document.ready?
Have re-read the Overview, Core, and Forms and Validators section of the
manual again -- thinking I'm missing some key concept -- but don't see what
I'm missing.
Have read dozens of Google Group posts with no luck.
Planning on downloading some sample web2py applications again like the CRM
project and hopefully see something in the code there that enlightens me.
If anyone can provide advice or nudge in the right direction of what to try
next, please let me know.
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.
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.