Why do you want pouchdb with web2py ? for client cache?
pouchdb is a client only database unless you sync it to a couchdb server.

Web2py is a server side framework.

Anyway your problem is a javascript/web2py problem , not a pouchdb/web2py
problem...

maybe this helps you a litle
https://stackoverflow.com/questions/13758417/how-to-get-http-get-request-value-using-javascript


Regards

2017-10-09 3:17 GMT+01:00 黄祥 <[email protected]>:

> tested with min app from js on views side, but the result is not expected,
> the form field name store in indexeddb {{=request.vars.your_name}} as is
> not the form field value
> *controllers/default.py*
> def pouchdb():
>     form = SQLFORM.factory(
>         Field('your_name', requires = IS_NOT_EMPTY() )
>         )
>     if form.process().accepted:
>         response.flash = 'form accepted'
>     elif form.errors:
>         response.flash = 'form has errors'
>     return dict(form = form)
>
> *views/default/pouchdb.html*
> {{extend 'layout.html'}}
> {{=form}}
> <script src="//cdn.jsdelivr.net/npm/[email protected]/dist/pouchdb.min.js
> "></script>
> <script src="{{=URL('static','js/test.js')}}"></script>
> {{=response.toolbar() }}
>
> *static/js/test.js*
> (function() {
> var db = new PouchDB('test');
> document.getElementsByClassName('form-horizontal')[0].addEventListener("submit",
> myFunction);
> function myFunction() {
>   var doc = {
>     "_id": "mittens",
>     "name": "{{=request.vars.your_name}}" // already tried
> "{{request.vars.your_name}}", "{{=form.vars.your_name}}",
> "{{form.vars.your_name}}"
>   };
>   db.put(doc);
> }
> })();
>
> any idea how to work with pouchdb in web2py?
>
> thanks and best regards,
> stifan
>
> --
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to