SQLFORM.factory creates a form based on what fields you pass to it. If you
pass tables, fields are extracted from the table definitions. However, it's
still "managed" as if it was a single table containing all the fields from
all the tables you pass, so there's only one table_name available. Of
course, all field names MUST be different (i.e. unique within the form).
On Tuesday, April 22, 2014 5:35:18 AM UTC+2, Greg Vaughan wrote:
>
> Hey Niphlod,
>
> Thanks for that answer... you are spot on in seeing the problem... my
> "#appointments_blah" id's did get changed to "#no_table_blah" hence the
> jQuery was targeting id's that no longer existed...
>
> To "fix" it I simply changed the hard coded script at this point to target
> "#no_table_unit", "#no_table_unit", "#no_table_unit", "#no_table_unit"
> etc... which is very ugly :(
>
> I can use input names to hide the data fields as you suggested above which
> is preferred but how would I hide the labels? They do not have a name
> property...
>
> I could not work out how to use the "form = SQLFORM.factory(Field() .....,
> table_name='appointments')" suggestion in this instance... I get it if I am
> using a normal instance of SQLFORM.factory... but in this case where i am
> referencing and updating two tables i cannot seem to get the syntax right...
>
> The relevant part >>> "form = SQLFORM.factory(db.appointments, db.notes)"
> <<< are you saying I wrap this section with the above and include all the
> fields?
>
> Eg... form = SQLFORM.factory(db.appointments, db.notes),
> Field('unit'),
> Field('unit_type'),
> Field('unit_number'),
> ...,
> table_name='appointments'
> )
>
--
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.