I started from scratch here is all the code running latest from trunk.

Seems I am still missing something.

(By the way I added an alert('running') to web2py_component() to see when it executes. Seems like after submitting the form it is never called.)

so I think response.js is not being called.

db.py
----
db.define_table('messages',
    Field('message',notnull=True))


default.py
----
def reload(target):
    def js(form):
        response.js = 'web2py_component("%s","%s")' % (URL(target),target)

    return js


def post_message():
return dict(form=crud.create(db.messages,onaccept=reload('list_message')))

def list_message():
    return dict(items = crud.select(db.messages) or 'No Messages')


default/index.html
----

{{extend 'layout.html'}}

{{= LOAD('default','post_message.load',ajax=True) }}
<hr />

{{= LOAD('default','list_message.load',ajax=True,target='list_message') }}


Still not working.



On 5/20/11 10:45 AM, Massimo Di Pierro wrote:
what's the view?


On May 20, 9:26 am, "David J."<[email protected]>  wrote:
I saw the video on creating components;

I tried following the steps outline there;

For some reasons I must have missed a step because the message post
table is not uploading;

Here is the code I think is not working correctly.

def reload(target):
      def js(form):
          response.js = 'web2py_component("%s","%s")' % (URL(target),target)

      return js

def posts():
        postform = SQLFORM(db.posts,onaccept=reload('post_text'))

I changed the example a bit from the one you used because you used a
Crud Form; but I just used SQLFORM instead which shouldn't really matter.

Thanks.

Reply via email to