It will post, but then there is the error when validation fails if i leave a
field empty (when it shouldn't be).  Here is the code:

def m101():
    form=crud.create(db.task)
    try:
      etime=str(db().select(db.task.etime, orderby=~db.task.id,
limitby=(0,1))[0].etime).split(':')
      form[0][4][1][0]['_value']=etime[0] + ':' + etime[1]
    except:
      pass

    form['_class']='ajaxform1'

    return DIV(SCRIPT("$(document).ready(function() {
$('#task_task').select(); });"), form)

I also just tried return dict(form=form) and get the same error.

-wes

On Fri, May 22, 2009 at 4:52 PM, mdipierro <[email protected]> wrote:

>
> are you using a custom widget? Can you post it?
> if not can you post the definition of the form?
>
> On May 22, 5:02 pm, Wes James <[email protected]> wrote:
> > yes that does submit now.  I left a field blank to check validation and
> get:
> >
> > Traceback (most recent call last):
> >   File "/opt/20090331-w2p/gluon/restricted.py", line 107, in restricted
> >     exec ccode in environment
> >   File "/opt/20090331-w2p/applications/tt/controllers/default.py"
> > <http://127.0.0.1:6667/admin/default/edit/tt/controllers/default.py>,
> > line 256, in <module>
> >   File "/opt/20090331-w2p/gluon/globals.py", line 80, in <lambda>
> >     self._caller = lambda f: f()
> >   File "/opt/20090331-w2p/applications/tt/controllers/default.py"
> > <http://127.0.0.1:6667/admin/default/edit/tt/controllers/default.py>,
> > line 14, in m101
> >     form=crud.create(db.task)
> >   File "/opt/20090331-w2p/gluon/tools.py", line 1579, in create
> >     deletable=False,
> >   File "/opt/20090331-w2p/gluon/tools.py", line 1537, in update
> >     onvalidation=onvalidation):
> >   File "/opt/20090331-w2p/gluon/sqlhtml.py", line 493, in accepts
> >     self.trows[fieldname][1][0].errors = self.errors
> > AttributeError: 'tuple' object has no attribute 'errors'
> >
> > On Fri, May 22, 2009 at 3:41 PM, mdipierro <[email protected]>
> wrote:
> >
> > > For now what you have to do it
> >
> > > form=crud.create(db.table)
> > > form['_class']='ajaxform1'
> >
> > > I am thinking on whether this should be the default behavior and who's
> > > responsibility is to set this behavior (the form? the frame? the app?)
> >
> > > On May 22, 4:21 pm, Wes James <[email protected]> wrote:
> > > > Massimo,
> >
> > > > is it the form submit and submitting data and getting a form back
> with
> > > > validation what you were indicating in the comments on the ajax
> panel?
> >
> > > > Because I can't use a crud form submit and get it to submit data, it
> just
> > > > refreshes the screen it seems.
> >
> > > > I can get a form with form=crud.create(db.table), but submit no
> go....
> >
> > > > thx,
> >
> > > > -wes
> >
> >
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to