at least you must include web2py.js that includes the javascript function you're using....
On Saturday, May 11, 2013 1:09:13 AM UTC+2, sasogeek wrote: > > nothing happens, and i think it's because i didn't include layout... > because when i do the exact same thing in the book, it works fine, but with > the same example, when i remove the extend layout line, it doesn't work > anymore.... i don't want to use the default layout though... what files > should i include? and how? > > On Friday, 10 May 2013 19:53:19 UTC+1, viniciusban wrote: >> >> What is exactly happening? >> >> The votesup field is not being added or the updated result is not being >> showed? >> Using some inspection tool, is your default/voteup() function being >> invoked? >> What did you already tried? >> >> Help us help you. >> >> >> >> On Fri, May 10, 2013 at 3:46 PM, sasogeek <saso...@yahoo.com> wrote: >> > I need help..... >> > >> > On Friday, 10 May 2013 16:53:23 UTC+1, sasogeek wrote: >> >> >> >> Model >> >> db.define_table('content', >> >> Field('username'), >> >> Field('text', 'text'), >> >> Field('file', 'upload'), >> >> Field('userpicture'), >> >> Field('time', 'datetime', update=request.now), >> >> Field('userid', readable=False), >> >> Field('votesup', 'integer', default=0), >> >> Field('votesdown', 'integer', default=0) >> >> ) >> >> >> >> >> >> Controller (default.py) >> >> def feed(): >> >> #postform >> >> postform = crud.create(db.content, next='feed') >> >> postform['_id']='postform' >> >> ... >> >> votesup = postform.element('input', _name='votesup') >> >> votesup['_type']='hidden' >> >> votesdown = postform.element('input', _name='votesdown') >> >> votesdown['_type']='hidden' >> >> contents = db().select(db.content.ALL, orderby=~db.content.id) >> >> return dict(postform=postform, contents=contents) >> >> >> >> def voteup(): >> >> item = db.content[request.vars.id] >> >> new_votes = item.votesup + 1 >> >> item.update_record(votesup=new_votes) >> >> return str(new_votes) >> >> >> >> >> >> View (default/feed.html) >> >> {{for content in contents:}} >> >> ... >> >> <span onclick="jQuery('#postform').val('{{=content.id}}'); >> ajax('voteup', >> >> ['votesup'], 'content{{=content.id}}');" style='padding:10px;'> >> >> <img src='../static/images/thumbsup.png' style='height:20px; >> >> width:20px;'/></span> >> >> <span id='content{{=content.id}}' >{{=content.votesup}}</span> >> >> >> >> {{pass}} >> >> >> >> When I click the image in the view "thumbsup.png", the votesup count >> >> doesn't increase... what am i doing wrong? >> >> >> > -- >> > >> > --- >> > 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+un...@googlegroups.com. >> > For more options, visit https://groups.google.com/groups/opt_out. >> > >> > >> > -- --- 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/groups/opt_out.