On Wednesday, August 15, 2018 at 8:12:37 AM UTC-7, lbjc...@gmail.com wrote:
>
> Am puzzled by this, that I cant post text from request.vars value to 
> database and when refreshing, the text is there but I cant access this 
> value to controller functions.
> This is my code:
> def progress_view():
>     form = SQLFORM(Post, formstyle='table3cols').process()
>     if request.vars:
>         r = [request.vars.name]
>         codes.append(r[0])
>         db.post.insert(name=codes[0])
>     #db(db.post.id > 11).update(message=codes[0])
>     row = db(db.post.author== auth.user.id).select(db.post.id, 
> db.post.name, orderby=~db.post.id, limitby=(0,1)).first()
>     code = row.name if row else None
>     return dict(code=code)
> Is there a way of accessing the CURRENT value from request.vars to 
> controller ? like append to a list without refreshing the page
> Is there a javascript/jquery function that can do DAL refresh?
>

I think there may be some confusion, because you *are* accessing the 
current value of request.vars.name in the controller,
which you put in a list and assign to r.  Perhaps you want to show it in 
the *view*, but you aren't returning anything but code to the view.  code 
is set to row.name, where you take the first tuple of the select() results 
(which are in reverse order).

If you're trying to look at the the row you just inserted, db.post.insert() 
returns the id of the new tuple, and that should allow your select() to be 
done by id.

If I misunderstood what you're trying to do, try explaining again what your 
workflow is and what you want to happen.

Dave
/dps




-- 
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.

Reply via email to