Using page variables in rjs templates

Hi everyone.

I have a CMS that uses a fckeditor-like WSIWYG setup. I’m writing an
ajax action that toggles the view between WSIWYG and a textarea that
shows the actual html.

To do that, I need to pull the existing content out of an iframe on
the page and reinsert it into the textarea.

page.assign(@content, $(‘edit’).contentWindow.document.body.innerHTML)

page.replace_html “texteditor”, ‘"#{@content}" </
textarea>’

It’s giving me syntax errors on the $(‘edit’) line, and I’m not at all
convinced that page.assign is what I’m looking for.

Help?

not to sure. but there are 2 points to keep in mind.

  1. the DOM is not cross browser compatible
    ie. innerHTML is deprecated and does not work in ie6
    so use prototype Event.update
    or JQuery (its not rjs but it could probable provide a graceful fix)

  2. Ajax is communicating with the server. Your just doing DOM
    manipulation.

Sorry, I couldn’t be more help. When you figure it out please post the
solution I plan to add similar functionality to an app of my own.