forms-mongoose
forms-mongoose copied to clipboard
Possible version issue?
Following your 2-line example:
var forms = require('forms-mongoose');
var form = forms.create(pcr, 'new'); // Creates a new form for a "new" pcr
// Use the form object as you would with Forms
console.log (form.toHTML());
I get these errors when I run the app. pcr is a mongoose Schema in my project:
/home/nmartin/Projects/pcr-appserver/node_modules/forms-mongoose/node_modules/forms/lib/forms.js:88
return html + form.fields[k].toHTML(k, iterator);
^
TypeError: Object n has no method 'toHTML'
here are the versions I'm using:
[email protected] node_modules/forms-mongoose
├── [email protected]
└── [email protected] ([email protected])
I think I may know what the issue is - it may be the way I load schemas -
var form = forms.create(PersonModel, 'new'); // Creates a new form for a "new" Person
The prototype for this function is now:
module.exports.create = function (model, extra_params, form_name, form_category) {
So this might be a documentation bug.
@nikmartin have you been able to solve this? I have the same problem.
var form = forms.create(PersonModel, '', 'new');
works:)
No, I'm not using the library anymore, it really didn't fit what I was doing
Sorry, yes there are possibly version issues here, I've not kept the code up to date :( I will take a look soon & update :)