Apologies if this is obvious, but I thought it could help someone who
doesn't have time to figure it out. Maybe someone has a better method?
Because the resources CFormsForm.js and __package__.js will be modified, it
is easiest to copy the forms resources
(build/cocoon/blocks/forms/dest/org/apache/cocoon/forms/resources) into a
resources directory in the desired mount directory. Add the dojo directory
to that resources directory (unpack the dojo lib or download the latest)
because forms-field-styling.xsl looks for dojo in the resources. All sitemap
references to resources uri should also be changed to point to the new
resources directory.
Modify resources/forms/js/__package__.js to get the Editor2 widget:
dojo.kwCompoundRequire({
common: [
"cocoon.forms.common",
"cocoon.forms.CFormsForm",
"cocoon.forms.CFormsRepeater",
"cocoon.forms.CFormsDragAndDropRepeater",
"cocoon.forms.CFormsSuggest",
"dojo.widget.InlineEditBox",
"dojo.widget.Editor2"
]
});
dojo.provide("cocoon.forms.*");
The Editor/Editor2 widget keeps its data in an iframe whose data must be
copied back to the cocoon widget when the form is submitted. Ajax-enabled
forms catch the forms submit event. I thought it would be cleaner to wrap
around the submit before cocoon got it, but it always ended up copying after
the submit; I ran out of time to work it out and instead modified
resources/forms/js/CFormsForm.js to copy the Editor2 widget inline frame
data back to the cocoon widget just before the submit, as follows:
_browserSubmit: function(invocation) {
.
.
.
dojo.lang.forEach(dojo.widget.byType("Editor2"), function(ed){
dojo.byId(ed.widgetId).value = ed.getEditorContent();
}
);
this.submit(target && target.name);
// If real submit has to occur, it's taken care of in submit()
return false;
},
In the form template, style the field widget as follows:
<fi:styling type="textarea" rows="3" style="width:100%" dojoType="Editor2"
htmlEditing="true" >
The htmlEditing flag is not necessary, but useful at times.
Hope this helps.
Don
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]