Using a custom form in your view should not change your controller
any.

Just use the same controller and instead of the view having:
{{=form}}

It should have:
{{=form.custom.begin}}
// your custom stuff including submit button
{{=form.custom.end}}

I've never tried it but setting formname to "None" is probably a bad
idea.  That's only used if you have more than one form on a page, but
my suspicion is that setting it to None could be a problem.  Either
don't use it or set it to something known.   It might not matter, but
why explicitly set it to none?  I can't think of a reason to do that.

On Aug 5, 4:27 pm, Sebastian Bassi <sba...@gmail.com> wrote:
> I did a function that returned a form generated automatically from
> data definition. Here are relevant part.
> Model:
> db = DAL('sqlite://storage.sqlite')       # if not, use SQLite or other DB
> db.define_table('sugerencias',
>
> Field('email','string',length=100,requires=IS_NULL_OR(IS_EMAIL())),
>                  Field('texto','string',length=8000,requires=IS_NOT_EMPTY()))
>
> Controler:
> def index():
>     form = SQLFORM(db.sugerencias)
>     if form.accepts(request.vars, session):
>         pass
>     return dict(form=form)
>
> It works as expected.
> But when I try to apply a custom HTML form using 
> thishttp://www.web2py.com/book/default/chapter/07#SQLFORM-in-HTMLI loose
> form validation, it is posted as get and the form doesn't submit the
> data to the DB.
> Here is the new controler:
> def index():
>     form = SQLFORM(db.sugerencias)
>     if form.accepts(request.vars, formname=None):
>         pass
>     return dict()
> View:http://pastebin.com/npCADyQs
> (I don't past it here since it would be a mess).
>
> I think I followed all instructions, but it is not working :)
>
> Best,
> SB.

Reply via email to