Thanks Massimo.

Fantastic! It works;

Thank you so much; I was scratching my head trying to figure it out;

Have a great night;

By the way do you have any Ajax polling examples anywhere?

Thanks.


On 5/21/11 10:46 PM, Massimo Di Pierro wrote:
My bad. I introduced a bug in 1.95.1. I just fixed it in trunk. You
need replace line 522-3 in main.py with

                         http_response.headers['web2py-component-
command'] = \
                             response.js.replace('\n','')


On May 21, 9:27 pm, "David J."<[email protected]>  wrote:
I made a post on Friday regarding some inter-component communications;

I see I had few responses; so I thought maybe to try again.

I was following the video on how to use web2py for components;

It seems like after the form is submitted; the table is not updated.

I think the problem is with the response.js code;

I will post the entire thing below again for reference;

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') }}

I also see these headers in Firebug

post tohttp://localhost:8000/ajax/default/post_message.load

X-Powered-By |web2py
|web2py-component-flash|"Form You"
|Set-Cookie|session_id_ajax=127.0.0.1-7a4406f9-01c9-46ab-ad14-4d83978d4d69;
Path=/
|Expires |Fri, 20 May 2011 18:50:53 GMT|
Pragma |no-cache|
Cache-Control|no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|web2py-component-command|"web2py_component(\"/ajax/default/list_message.lo 
ad\",\"list_message\")"|
Content-Type|text/html; charset=utf-8
|Date|Fri, 20 May 2011 18:50:53 GMT
|Server|Rocket 1.2.2 Python/2.7.1
|Content-Length|699
|Connection|keep-alive|

Thanks in advance if anyone could help me understand what is wrong here;

Thanks.

David.

Reply via email to