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 this
http://www.web2py.com/book/default/chapter/07#SQLFORM-in-HTML I 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