Hi Annet,

you can do it by inserting new table rows at the appropriate places.

Here is how:
SQLFORM.factory (or SQLFORM in general) creates a table where each
SQLField (Field) sits in a table row.
form[0] is the table (TABLE)
form[0][0] is the first row (TR)
form[0][1] is the second row
and so on.

Now think of a web2py TABLE object as python list of TR objects [TR1,
TR2, ...]
Each TR is also a list of TD objects, but that is not relevant to this
case.
TABLE objects provide an insert function akin to a python's list
insert function.

How can you know this? In the shell do a dir(form[0]) .
You would see "insert" among the listed names and relate that to
python's list insert.
Or using epydocs
http://mdp.cti.depaul.edu/examples/static/epydoc/index.html
look for TABLE on left hand side, click on it, look for "Instance
Methods" (aka functions) in the main window, see "insert" and relate
that to Python's or if you follow the "insert" link it will say "list
style inserting of components"... ;)

But I digress. To add a row you would do:
form[0].insert(row_number_to_be_inserted,content_of_row)
To illustrate I will use 'Contactpersoon' as an example, note that I
started at the end to not mess up the insertion point as objects get
added in front of it and change the row number:
form[0].insert(14,TR(H3('Bedrijfsgegevens')))
Also note that you have to use the full syntax (you can not omit the
TR, which you can only do when creating a TABLE).

Now you can display your form and see the results, the supplied CSS
might get in the way of your intended results but that is another
story.

Denes.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to