Hmm!
You seem to not use the web2py view tamplate system... You don't need your
custom form is you just create a register.html file in the
views/YOURCONTROLLER.
All you have to write in your register.html file is {{=form}} and web2py
will generate the html code of the form and render a html page if you go to
the url : http://127.0.0.1/yourapp/yourcontroller/register...
Then, if you want to use the web2py customing form tool it as easy as it is
explained in the book since each of the field contained in the form are
broken into single pieces... So you can change the order of the field at
the view level for example.
Richard
On Tue, Jul 3, 2012 at 4:18 PM, Chris <[email protected]> wrote:
>
> I've just started with web2py, so this might be obvious but I struggle to
> see how it works:
>
> I have a controller action which returns a form:
>
> def register():
> return dict(form=auth.register())
>
> I also have a view 'register.html' for this action, which is *
> self-contained* as it does NOT use any of the web2py frontend .css or .js
> stuff. All the HTML, CSS and JS are already done for the form too, e.g.
>
> ...
> <form method="post" class="h5form">
> <div class="own-labels">
> <label>First name<sup>*</sup></label>
> <input type="text" name="firstName" class="span3" placeholder="enter
> text…" required="required" tabindex="0">
> <label>Last name<sup>*</sup></label>
> <input type="text" name="lastName" class="span3" placeholder="enter
> text…" required="required" tabindex="1">
> <label>Email<sup>*</sup></label>
> <input type="email" name="email" class="span3" placeholder="enter
> text…" required="required" tabindex="3">
> </div>
> <div class="pull-left">
> <input type="submit" class="btn pull-right" style="margin-top:
> 15px;" value="Register">
> </div>
> </form>
> ...
>
> So now, how do I link the returned 'form' variables to the right fields in
> this pre-defined view? In the manual, it briefly mentions the use of
>
> {{=form.custom.begin}}
> ...
> {{=form.custom.end}}
>
> but it is not very clear to me how should I use it in my case. Is this
> only and right approach for implementing custom forms whose views are
> already fully defined in HTML, CSS and JS? Thank you.
>