Thanks very much - this exactly answers my question.
On Sep 30, 2:49 pm, Jose <[email protected]> wrote:
> On 30 sep, 17:41, MichaelT <[email protected]> wrote:
>
>
>
> > Hi,
>
> > ** I think I made a mistake and first created a topic instead of a
> > post. Rookie mistake, Sorry for dupe. ***
>
> > I'm trying to understand what I have to do and what can be done
> > automatically with FORM (not SQLFORM).
>
> > I want to create a form that is the same functionally as SQLFORM,
> > meaning the fields from related tables are populated as drop down
> > buttons, etc. But I don't want to use SQLFORM.
>
> > Can FORM populate the drop down list or do I need to select the
> > records to a record object and then use that object ?
>
> > Can someone point me to a complete example?
>
> > Thanks very much.
> > Michael
>
> Hi,
>
> def myform():
> rows = db().select(db.mytable.ALL, orderby=db.mytable.myfield,
> cache=(cache.ram,3600))
>
> sel_rows = SELECT(_name='id_1', _id='id_1',
> *[OPTION(rows[i].myfield, _value=rows[i].id) for i in range
> (len(rows))])
>
> form = FORM(TABLE(
> TR("A Label:", sel_rows),
> TR("", INPUT(_type="submit")
> )
>
> return dict(form=form)
>
> Jose
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---