Did you figure out what was wrong? I faced the same issue. Everything works fine when I take out the ajax function.
On Sunday, May 4, 2014 9:33:05 AM UTC-4, John Drake wrote: > > I've created a simple ajax form to update a "post" database. For some > strange reason when I post a new message, the button greys out. > > Here is the model: > > db.define_table('t_post', > Field('f_post', type='text', > label=T('Post')), > auth.signature, > format='%(f_post)s') > > Here are my controller functions. > > def ajax_post(): > posts = crud.select(db.t_post, fields=['f_post'], query = > db.t_post.created_by == auth.user, > headers={'t_post.f_post': 'Post'}, orderby = > ~db.t_post.created_on) > search = crud.search(db.t_post) > return dict(posts=posts, search=search) > > def new_post(): > postdata = request.vars.post > db.t_post.insert(f_post = postdata) > posts = crud.select(db.t_post, fields=['f_post'], query = > db.t_post.created_by == auth.user, > headers={'t_post.f_post': 'Post'}, orderby = > ~db.t_post.created_on) > return posts > > Here is the model: > > {{extend 'layout.html'}} > <h1>This is the default/ajax_post.html template</h1> > <form onsubmit="return false"> > <div>Post : <input name="post"/></div> > <div><button onclick="ajax('new_post', ['post'],'results')">Post > Message</button></div> > </form> > <div id="results"> > {{=posts}} > </div> > <div> > {{=search[0]}} > </div> > > At first I used an input field with type "submit" for the submit button. > When that happened, it would > grey out and the value would set to "Working....". At least now button > text doesn't change, but it > it still grey's out. Inspecting the element in Firefox I get: > > <button value="Working..." class="btn disabled" onclick="ajax('new_post', > ['post'],'results')">Post Message</button> > > Why? I didn't ask it to change the button's class to disabled. And it > stays greyed even though > the results have returned and my "results" div has been properly updated. > I can still click on > the button, but it just appears disabled. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.