SQLFORM make a FORM from a database table.
you can make a form manually:

form=FORM(TABLE(TR(TD(...))))

or you can use a factory (to pretend you have a database table

from gluon.sqlhtml import form_factory
form=form_factory(SQLField('name','string',requires=IS_NOT_EMPTY(),label='Your
Name'),SQLField('birth','date'))

they both work like a SQLFORM but the former does not handle automatic
file upload, the latter does.

On Oct 28, 12:49 pm, Iceberg <[EMAIL PROTECTED]> wrote:
> Hi, Massimo,
>
> I start learning web2py for a week and it is already addictive. :-)
> Thank you very much.
>
> Now I encounter a tricky problem: Can SQLFORM accept TABLE(...) as its
> first parameter?
>
> The problem description might be clear, but not its background. So I
> gonna explain some more.
>
> My application is an sales order management system, which has a
> complicated "orders" table. Instead of using the default view layout
> generated by the simple code as "form=SQLFORM(db.orders)" in
> controller add(), I manually build a form in this way, to customize
> the layout:http://mdp.cti.depaul.edu/AlterEgo/default/show/128
>
> But later when I want to implement an update page and a view page for
> the old orders, I find out that there is no obvious simple way to
> reuse the layout I have just built.  Followed my intuition, I tried
> this:
>   form=SQLFORM( TABLE( TR(...bla bla, copied and pasted from add()
> controller...) ),  one_order_record )
> however, it does not work.
>
> Do I have to create a edit.html view and arrange every components
> manually in HTML level?  That is labouring, and the worse is that can
> not reuse the effort in my add() controller.
>
> Any suggestion? Thanks in advance!
>
> Sincerely,
>              Iceberg, 2008-Oct-29, 01:18(AM), Wed
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to