Skip to main content

JMaki getting value from Editor

7 replies [Last post]
kalichar
Offline
Joined: 2005-09-14

Hi All, I had a simple question. I am using JMaki with Struts and once editing completes on the form, I would like to get the contents of the JMaki dojo editor and store it in a database. Can you please let me know as to how I can retreive the contents of the dojo editor?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
daveraikar
Offline
Joined: 2007-02-14

Can you please share a sample or skeleton of Jmaki with Struts ?

Thanks
-Dave

gmurray71
Offline
Joined: 2003-07-31

We not have a issue filed on this:

https://ajax.dev.java.net/issues/show_bug.cgi?id=120

gmurray71
Offline
Joined: 2003-07-31

You'll need to update the /resources/dojo/editor/component.js in the current jMaki .5.1 to be the following:

var container = document.getElementById(widget.uuid);

var editor = dojo.widget.createWidget("Editor2",
{ shareToolbar: false,
toolbarAlwaysVisible: true,
focusOnLoad: false
}, container);

jmaki.attributes.put(widget.uuid, editor);

Then you can do the following from a JSP page:

Show Editor

The property on the Editor you are concerned with is "getEditorContents"

I'll put this fixed component.js into the jMaki .6 release.

kalichar
Offline
Joined: 2005-09-14

Thanks for this response. It worked great for me. I was wondering how can I set a value to the editor on initial load by taking it from a bean?

For example

Thanks.

gmurray71
Offline
Joined: 2003-07-31

If you are using JSF you can set the value using a value binding expression with a managed bean:

Right now the tag values are not taking in dynamic values though I think we should allow this type of behavior. I've going filed issue and try to get this working for all jmaki widgets. See: https://ajax.dev.java.net/issues/show_bug.cgi?id=29

kalichar
Offline
Joined: 2005-09-14

Hi,

Thanks for the response. Sadly, I am not using JSF. I am using struts and was hoping for an equivalent

I was wondering if you have a hack or work around for this as yet? Thanks again for the assistance.

gmurray71
Offline
Joined: 2003-07-31

Hi,

Your code should work with jMaki v. 6. You can get the preview here:

https://ajax.dev.java.net/servlets/ProjectDocumentList