your_model.py:

db.define_table('moment',
  Field('textarea','text'),
  Field('txttype', readable=False, writable=False),
  ...
)

default.py:

def moment_type(form):
  form.vars.txttype=...

def submit_moment():
  form=SQLFORM(db.moment)
  if form accepts(request.vars, session, onvalidation=moment_type):
    response.flash = 'form accepted'
  elif form.errors:
    ...
  return dict(form=form, ...)

views/default/submit_moment.html:

{{extend 'layout.html'}}
{{=form}}


On Dec 1, 11:47 am, hswolff <[email protected]> wrote:
> I'll try the model implementation.  I need to be able to parse the
> submit content and count the frequency a word appears and set the type
> accordingly.
>
> I'm using response.moment_form because when I had it in the index()
> function and I would go to the user page it wouldn't render because
> the dict wouldn't return the form that was displayed on views/
> layout.html.
>
> Correct me if I'm wrong:  if I were to make a submit_moment():
> function and a views/default/submit_moment.html view I would be able
> to include the view on every page and have it be functionally
> accurate, right?
>
> I'm still getting the hang of web2py's MVC.
>

Reply via email to