Widget Editor Save & Cancel

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Widget Editor Save & Cancel

Kevin Old
Hello everyone,

I've read the Rich Text article about the Editor Widget and love it!
I've been using it as a textarea and can't figure out how to get the
HTML out of the textearea without posting the form.  I've tried
calling it via getElementById, but get nothing returned for the value.

I was thinking that the Save button might return the value, but am not
sure how to get it.

On the Rich Text article it shows using the dojo.io.bind object to
retrieve the content, but I'm not sure how that would work with a text
area?

I've looked for docs on the Save & Cancel buttons, and would like to
override them if I could, but can't seem to figure out how.

Any help is appreciated!

Kevin
--
Kevin Old
[hidden email]
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Widget Editor Save & Cancel

Rogers Reilly
i'm using the plain old <div> version of the editor, not <textarea>, but
i wouldn't be surprised if this worked for you as well:

var contentInsideEditor =
dojo.widget.manager.getWidgetById("yourWidgetId")._richText.editNode.innerHTML

"yourWidgetId" is declared with a widgetId attribute, in case you
haven't used it before.

the same method (i.e. _richText.editNode.innerHTML) allows you to
manipulate the content inside the rich text editor; for example, i've
linked the content of one editor to another by setting one's
_richText.editNode.innerHTML = some manipulation of the other's.  (I
wanted to create a "Teaser" editor that could either be automatically
generated from the first few paragraphs of the "Body" editor, or edited
manually with all the rich text goodies, depending on a radio toggle.)

hope that helps-
Rogers

Kevin Old wrote:

>Hello everyone,
>
>I've read the Rich Text article about the Editor Widget and love it!
>I've been using it as a textarea and can't figure out how to get the
>HTML out of the textearea without posting the form.  I've tried
>calling it via getElementById, but get nothing returned for the value.
>
>I was thinking that the Save button might return the value, but am not
>sure how to get it.
>
>On the Rich Text article it shows using the dojo.io.bind object to
>retrieve the content, but I'm not sure how that would work with a text
>area?
>
>I've looked for docs on the Save & Cancel buttons, and would like to
>override them if I could, but can't seem to figure out how.
>
>Any help is appreciated!
>
>Kevin
>--
>Kevin Old
>[hidden email]
>_______________________________________________
>Dojo-interest mailing list
>[hidden email]
>http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
>  
>

_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Widget Editor Save & Cancel

Alex Russell
On Wednesday 14 December 2005 9:18 pm, Rogers Reilly wrote:
> i'm using the plain old <div> version of the editor, not <textarea>,
> but i wouldn't be surprised if this worked for you as well:
>
> var contentInsideEditor =
> dojo.widget.manager.getWidgetById("yourWidgetId")._richText.editNode.
>innerHTML

You shouldn't need to reach into the editor like this. It has a
getEditorContent() method, so you can just do:

var content = dojo.widget.byId("yourWidgetId").getEditorContent();

Note that any content filters registered on the editor are used to
process the content when getEditorContent() is called, so it's suitable
for all manner of post-processing tasks (e.g., making the content valid
XHTML).

Regards

--
Alex Russell
[hidden email] BE03 E88D EABB 2116 CC49 8259 CF78 E242 59C3 9723
[hidden email]  F687 1964 1EF6 453E 9BD0 5148 A15D 1D43 AB92 9A46
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Widget Editor Save & Cancel

Matthias Krappitz
> You shouldn't need to reach into the editor like this. It has a
> getEditorContent() method, so you can just do:
>
> var content = dojo.widget.byId("yourWidgetId").getEditorContent();

Hi There, I got the very same problem. But when I do it like that, the
javascript alert just prompts "undefined". The Editor works and I'm using Dojo
0.2.0 "kitchen sink" edition:

---

<script src="../../dojo/dojo.js" type="text/javascript"></script>
<script type="text/javascript">
  dojo.require("dojo.widget.Editor");
  var content = dojo.widget.byId("contentNode").getEditorContent();
</script>

<div id="contentNode" dojoType="Editor">
  some content
</div>
<a href="javascript:alert(content)">show editors content</a>

---

I would really appreciata a hint regarding that. Btw. how can I figure out, how
to get data or content out of other widgets such as DatePicker, TimePicker, ...
without any documentation?

_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Loading...