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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
blogmad
Forum Newbie
Posts: 2
Joined: Sat Dec 05, 2009 2:04 pm

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

Post 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
WebbieDave
Forum Contributor
Posts: 213
Joined: Sun Jul 15, 2007 7:07 am

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

Post 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.
blogmad
Forum Newbie
Posts: 2
Joined: Sat Dec 05, 2009 2:04 pm

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

Post 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.
Post Reply