Dojo

dojo.io.bind and Rich Text

I'm playing around with Dojo a lot at the moment and it's getting better by the week but there are still "hinky" areas. One of the things which has been really bugging me is using dojo.io.bind in conjunction with the Editor2 widget against a textarea. (I think we've all been there haven't we!)

If you run the widget against a textarea and submit normally then all works fine but there seems to be a bug in the binding of the widget and the textarea when submitting asynchronously. So to get around this you should simply use the following line before you call dojo.io.bind:
dojo.byId("mytextarea").value = dojo.widget.byId("mytextarea").getEditorContent();
But whenever I have tried that I get a null or object not found error in IE and Firefox so after a lot of reading I've come up with this as an alternative:
dojo.byId("mytextarea").value = dojo.widget.byId("mytextarea")._richText.
editNode.innerHTML;
As ever with Dojo it's constantly changing so I'm not sure how long my hack will work (or indeed when the underlying bug will be fixed) but as of 0.4.1 today it seems to get around the problem.