You are mixing a SQLFORM (the form in the first two lines) with a FORM
(in the register function). If you want db access you need to insert
the former not the latter. If you want a custom form you should not
use FORM at all, you should just place the {{=form.cutsom.widget}}s in
the view.

On Jul 26, 3:47 pm, elfuego1 <elfue...@gmail.com> wrote:
> In default.py I had defined my registration form
>
> lbl=form.custom.label
> wdgt=form.custom.widget
>
> def register():
>     form=FORM(TABLE(TR(lbl.username), TD(wdgt.username),
>                     TR(lbl.password), TD(wdgt.password),
>                     TR(lbl.first_name), TD(wdgt.first_name),
>                     TR(lbl.last_name), TD(wdgt.last_name),
>                     TR(lbl.phone_no), TD(wdgt.phone_no),
>                     TR("",INPUT(_type="submit",_value="SUBMIT"))))
>     if form.accepts(request.vars,session):
>         response.flash="Form accepted"
>     elif form.errors:
>         response.flash="Form is invalid"
>     else:
>         response.flash="Please fill the form"
>     return dict(form=form,vars=form.vars)
>
> This submit gives me only information "Form accepted", but actual data
> is not saved into database.
> When I try to add submit button using "form.custom.submit" I recive an
> error:
> AttributeError: 'tuple' object has no attribute 'custom'
>
> When I add email input field using wdgt.email then this line
>
> if form.accepts(request.vars,session):
>
> gives an error:
>
> TypeError: expected string or buffer
>
> I need to know how should I add an email field to the registration
> form, so it would be accepted and how do you add a SUBMIT button to
> the form so the data would be stored in database?

Reply via email to