<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="gmail_quote">On Mon, Apr 11, 2011 at 5:28 AM, John M. Dlugosz <span dir="ltr">&lt;<a href="mailto:wxju46gefd@snkmail.com" target="_blank">wxju46gefd@snkmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have a form where an admin can change a part of the content on a page.  The form lets someone do it without having to update the files on the server in a more traditional manner; BUT, it must be correct XHTML.  If the admin types a &lt;p&gt; or a stray &#39;&lt;&#39; for that matter, it will render the resulting page not well-formed.<br>



<br>
Combine that with the feature of serving XHTML to browsers that accept it, and the site breaks on browsers other than IE.<br><br></blockquote></div></blockquote><div>On 11 April 2011 15:33, Nicholas Wehr <span dir="ltr">&lt;<a href="mailto:catalyst@bionikchickens.com">catalyst@bionikchickens.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
I&#39;ve used this before - perhaps it will work for you:<br><blockquote class="gmail_quote" style="margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex; ">
<a href="http://ckeditor.com/" target="_blank">http://ckeditor.com/</a><br></blockquote><div><br></div></blockquote></div><div><br></div><div>There are two main JS editors, the one above and TinyMCE, you have to be careful though.</div>
<div><br></div><div>1) People paste a Word document paragraph in as HTML and it becomes invalid.</div><div>Try offering a paste-from-word button to bring up a box they paste into, then send that to the backend to be run through <a href="http://search.cpan.org/perldoc?Text::Demoroniser">http://search.cpan.org/perldoc?Text::Demoroniser</a> before you add it to the content area.</div>
<div><br></div><div>2) Hitting bugs in these editors giving you invalid XHTML.</div><div>What you can do is </div><div>- validate by sending the content server-side before save and check with a DTD schema validator like <a href="http://htmlhelp.com/tools/validator/">http://htmlhelp.com/tools/validator/</a> and on failure disallow save with a popup warning</div>
<div>- then offer an option to correct invalid XHTML where you send the content to the backend, run it through htmltidy, then bring it back to the content area; see the HTML -&gt; XHTML docs in  <a href="http://tidy.sourceforge.net/docs/tidy_man.html">http://tidy.sourceforge.net/docs/tidy_man.html</a></div>
<div><br></div><div><br></div><div>Regards, Peter</div><div><a href="http://perl.dragonstaff.co.uk">http://perl.dragonstaff.co.uk</a></div><div><br></div></div>