close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Editor Javascript Access

Thread began 2/04/2011 9:12 pm by haveben10953 | Last modified 2/08/2011 8:29 am by Jason Byrnes | 2272 views | 5 replies |

haveben10953

Editor Javascript Access

I am trying to generate a "preview" function to show my user how the content they have typed into the instance of the HTML Editor will look. I was going to use the FCKeditorAPI.getInstance function of the API, but it doesn't seem to be available in the head of the document.

How do I get the inner HTML content of the editor using JavaScript?

Note: this is just a small part of a larger form, so submitting the form is not an option.

Thanks,
Ben C.

Sign in to reply to this post

Jason ByrnesWebAssist

you would need to use the window.open method and feed the htmleditor instance contentto the new window.

<input type="button" name="button" id="button" value="PreView" onClick="my_window = window.open('', 'mywindow1', 'status=1,width=350,height=150');my_window.document.write(''+FCKeditorAPI.GetInstance('test').GetHTML()+'');"/>




this is a rough sample and you will need to modify it to suit your needs.

Sign in to reply to this post

haveben10953

Okay

So, can the "open window" function be located in the head of the document, or does it need to be after the editor declaration on the page? Calling to the API in the head didn't seem to work for me.

Thanks,
Ben

Sign in to reply to this post

Jason ByrnesWebAssist

just calling it in the head will not work.

you would need to call it as a part of a button action such as the onClick event.

this is why my sample had the open window function as part of a button onclick event.

you could certainly create a javascript function that uses window.open, and call that function as a part of the onclick event.

but the key is the onclick event.

there are many sites that will give you examples of creating a function using windpow.open andd tying it to a buttons onclick.

Sign in to reply to this post

haveben10953

Still not working

The problem I have is not how, or where to use JavaScript. It is where the FCKeditorAPI becomes accessible. I used your previous code example, using the button, below the editor script on the page and get the same error I was having before. "FCKeditorAPI" is undefined. I looked at the source and it is below the PHP-generated call to <script type="text/javascript" src="webassist/ckeditor/ckeditor.js?t=A8LE4JO"></script>.

So, my question is still... how do I access the content of the editor using JavaScript in order to populate a preview page for my user?

If you could show me a working example where you applied the WebAssist extension (as-is) and get this to work, I could probably figure it out myself.

Thanks a bunch and sorry to be a bother,
Ben

Sign in to reply to this post

Jason ByrnesWebAssist

The HTML Editor toolbar includes a preview button already, you really dont need to create a new one yourself.

See the attached screen shoot of the preview button toolbar icon.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...