Page 1 of 1

How to accept formatted text in an input box on a web page

Posted: Sat Dec 05, 2009 2:48 pm
by blogmad
Hi, I'm a PHP novice trying to build a small notetaking application. One of the things, I need to do is let someone paste formatted text into an input box. The input box must allow me to retain any formatting in the copied text.

For example, look at the input section in this image.

Image

would I be right in saying, I need an embedable wysywig editor for this? Any suggestions? thanks

Re: How to accept formatted text in an input box on a web page

Posted: Sat Dec 05, 2009 5:59 pm
by WebbieDave
Your image did not show properly. However, your hunch is correct (about using a js wysiwyg editor). You can save the resulting html into the db. There are several free js wysiwyg editors our there. Just google away.

Re: How to accept formatted text in an input box on a web page

Posted: Sat Dec 05, 2009 7:05 pm
by blogmad
WebbieDave wrote:Your image did not show properly. However, your hunch is correct (about using a js wysiwyg editor). You can save the resulting html into the db. There are several free js wysiwyg editors our there. Just google away.
thanks for that... I've found one called http://xstandard.com/. Lite version is free and it seems to be very standards compliant. Got it working, just trying to figure out how to use alternate external css files with it.

I insert the wysywig object with this code

Code: Select all

 
         <object type="application/x-xstandard" id="editor1" width="100%" height="400">
                    <param name="Value" value="<?php echo htmlspecialchars($content, ENT_COMPAT) ?>" />
                                       [color=#BF00FF] <param name="CSS" value="http://localhost.localdomain/styles/paul.css" />[/color]
                    <textarea name="alternate1" id="alternate1" cols="60" rows="15">
                                        <?php echo htmlspecialchars($content, ENT_COMPAT) ?></textarea>
    </object>
 
You wouldn't know how to dynamically switch the css file its linking to? (i.e. I click a link and its switches to another css layout) No bother if you don't. I'll just start a new topic.