The XHTML WYSIWYG Editor For Desktop & Web Applications

Step 2 - Getting Data From XStandard

Unlike form elements, plug-in controls don't send data back to the server. To get around this, Web developers use a common technique that is reliable and easy to implement. Before the page is submitted, copy the data from the editor into a hidden field using JavaScript. When the form is submitted, the server-side script (ASP, PHP, ColdFusion, etc.) will read the data from the hidden field.

This is an example of JavaScript copying data from XStandard into a hidden field:

  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function myOnSubmitEventHandler() {
  5. document.getElementById('editor1').EscapeUnicode = true;
  6. document.getElementById('xhtml1').value = document.getElementById('editor1').value;
  7. }
  8. </script>
  9. </head>
  10. <body>
  11. <form method="post" onsubmit="myOnSubmitEventHandler()" action="mypage.htm">
  12. <p>
  13. <object type="application/x-xstandard" id="editor1" width="100%" height="400">
  14. <param name="Value" value="Hello World!" />
  15. </object>
  16. </p>
  17. <p>
  18. <input type="hidden" name="xhtml1" id="xhtml1" value="" />
  19. <input type="submit" name="btnAction" value="Submit" />
  20. </p>
  21. </form>
  22. </body>
  23. </html>

This is an example of a server-side script (in this case an ASP example) reading data from the hidden field:

  1. <%
  2. strXHTML = Request.Form("xhtml1").Item
  3. %>