On Sep 23, 5:46 am, Arvind <
arvind.ran...@gmail.com> wrote:
> > print dir(form) - to get variables/methods
> > print dir(form.attributes) - dict of attributes (formname, id, etc.)
> I might sound really silly. Where do i place the print command ? it
> wont work in the controller or in the view.
Web2Py shell.
Either at OS CLI or via the appadmin CLI.
I do loads of little experiments/explorations in the shell to try
stuff out quickly before transferring to the text files that make up
the app.
> and I am still not clear....
> if I have a form, like this
> form = FORM("your name:",
> INPUT(_name="yourname",requires=IS_NOT_EMPTY()),
> INPUT(_type="submit"))
I don't find it terribly useful to use FORM - using SQLFORM or crud is
generally more useful.
> How can i place the elemets of the form in a customized way....
> something like this
> <table>
> <tr> <td> {{=form.label}} </td> </tr>
Not sure about FORM, but SQLFORM is:
{{=form.custom.begin}}
{{=form.custom.label.myfield}}
> <tr> <td> {{=form.input._name}} </td> </tr>
Likewise
{{=form.custom.widget.myfield}}
> <tr> <td> {{=form.submit}}</td> </tr>
{{=form.custom.submit}}
{{=form.custom.end}}
> Note... in the above example, I have chosen to place the submit button
> after 3 rows... this way, i get to place my form, in my own way,
> rather than web2py automatically placing them in a table or in its own
> way.
This is the whole point of custom forms, yes - you get all the
benefits of the self-processing forms, whilst retaining the ability to
keep full control of the layout.
F