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.