This example demonstrates how to use Connection Manager to post data to the server, filter it and return it to the Editor.
Setting up the Editor's HTML is done by creating a
textarea control on the page.
textarea is on the page, then initialize the Editor like this:
We need to setup the callback object for Connection Manager. In the
handleSuccess function, we will
eval the data returned from the server.
Then we will call
myEditor.setEditorHTML with the new HTML.
Using a Button control, we create the new Button and subscribe to the
click event to begin the transaction.
Before making the request, we need to pull the HTML from the editor by calling the
myEditor.saveHTML method. This will place the filtered HTML from the Editor back into the textarea.
Once we have that, we contruct our query string, and fire off the request.
Note: The request is wrapped in a short
setTimeout to allow the browser to finish the cleanup calls that the Editor is making.
On the server side, first we filter the HTML to remove harmful HTML elements. Then we are doing a simple text filter (in this case the Elmer Fudd filter) and adding a "tagline" to the bottom of the data.
Once our filtering is complete, we are returning the new data to the browser.
Note: You are viewing this example in debug mode with logging enabled. This can significantly slow performance.