Need example of using the embedForm widget

54 views
Skip to first unread message

Todd

unread,
Sep 23, 2011, 4:17:57 AM9/23/11
to kanso
I just started using Kanso and I think I need help using the embedForm
widget. Here's what I'm trying to do:

The user clicks an "Add an activity" link. The server would return an
Activity form using a show function. Within the Activity form, I'd
like the user to be able to fill in an Activity Details form. I'd like
the Activity form to produce an Activity document and the Activity
Details form to produce an Activity Details document.

I thought I should use an embed field with an embedForm widget. When I
try this with the following type definition, I get an "obj is
undefined" error and the Activity form doesn't render. Since I can't
find an example of what options I should put for the embedForm widget,
I'm wondering if I'm missing some required data in the options object.

Here are the type definitions I'm working with:

exports.activitydetail = new Type('activitydetail', {

fields: {
created: fields.createdTime(),
createdBy: fields.creator(),
description: fields.string({
widget: widgets.textarea({cols: 40, rows: 10})
}),
tags: fields.string(),
priority: fields.string()
}
});

exports.activity = new Type('activity', {

fields: {
created: fields.createdTime(),
createdBy: fields.creator(),
title: fields.string(),
body: fields.embed({
type: exports.activitydetail,
required: false,
widget: widgets.embedForm({
type: exports.activitydetail
})
})
}
});

Jake

unread,
Feb 11, 2012, 5:28:30 PM2/11/12
to ka...@googlegroups.com
Just wanted to bump this - having a similar problem with my embedList() - form won't render, with the error "Cannot read property 'uuid' of null"

Thanks,
Jake

Daniel

unread,
May 4, 2012, 2:35:34 AM5/4/12
to ka...@googlegroups.com

+1

I ran in to the same problem, but worked around by creating a default_value handler that returned nothing. It appears to work though, but I wasnt able to get embedForm to behave the way I expected - what I wanted was for every embedded document in my embedded list to appear in its own embedded form. Its unclear to me if that was indeed the intent behind embedForm, so some guidance would be greatly appreciated.

Daniel

Message has been deleted

Pea-Pod

unread,
Sep 28, 2013, 5:14:28 PM9/28/13
to ka...@googlegroups.com
@ Daniel. Hmm, having same kind of problem. New to web dev though so could you please elaborate what you mean by 'creating a default_value handler'? Or for that matter if you have any other approach on how to get embedForm to work.

Thanks in advance  //  Pea-Pod

Pea-Pod

unread,
Sep 28, 2013, 5:17:38 PM9/28/13
to ka...@googlegroups.com, tba...@gmail.com
+1 & BUMP

Ending up with:
{"error":"render_error","reason":"function raised error: (new TypeError(\"fields is not an object\", \"couchtypes/fieldset\", 29))..

Also looking for an example.. anyone? anywhere?

Cheers!  //  Pea-Pod
Reply all
Reply to author
Forward
0 new messages