forms-mongoose icon indicating copy to clipboard operation
forms-mongoose copied to clipboard

Possible version issue?

Open nikmartin opened this issue 12 years ago • 6 comments

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])

nikmartin avatar Jun 09 '13 22:06 nikmartin

I think I may know what the issue is - it may be the way I load schemas -

nikmartin avatar Jun 10 '13 17:06 nikmartin

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 avatar Jun 10 '13 17:06 nikmartin

@nikmartin have you been able to solve this? I have the same problem.

arve0 avatar Jul 05 '13 18:07 arve0

var form = forms.create(PersonModel, '', 'new');

works:)

arve0 avatar Jul 05 '13 18:07 arve0

No, I'm not using the library anymore, it really didn't fit what I was doing

nikmartin avatar Jul 06 '13 01:07 nikmartin

Sorry, yes there are possibly version issues here, I've not kept the code up to date :( I will take a look soon & update :)

GothAck avatar Sep 22 '13 13:09 GothAck