yes, you are right, it's javascript/web2py problem, fix it with:
*controllers/default.py*
def pouchdb():
form = SQLFORM.factory(
...
)
if form.process(formname = request.function).accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
return dict(form = form)
*static/js/test.js*
(function() {
var localDB = new PouchDB('test');
/*
var remoteDB = new PouchDB('http://localhost:5984/test');
localDB.sync(remoteDB).on('complete', function () {
console.log('Synced!');
}).on('error', function (err) {
console.log('Error!');
});
*/
document.getElementsByClassName('form-horizontal')[0].addEventListener("submit",
addFunction);
function addFunction() {
var doc = {
_id: new Date().toISOString(),
form: jQuery('input[name = _formname]').val(),
show: {
testcheckbox0: jQuery('#testcheckbox0').val(),
testcheckbox1: jQuery('#testcheckbox1').val()
},
testselect: jQuery('select[name = testselect]').val(),
testinput: jQuery('input[name = testinput]').val()
};
localDB.put(doc);
}
})();
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.