Insert Items each side of selected text - How?

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
XF|Fatalpixel
Forum Newbie
Posts: 2
Joined: Wed May 12, 2004 12:56 pm

Insert Items each side of selected text - How?

Post by XF|Fatalpixel »

I am fairly new to this so bear with me.

I have a form where people fill in all sorts of information. I then use FPDF to generate a PDF. All well and good, FPDF, provide an nice HTML parser.

My problem is that some users do not know, or can't be bothered to enter the HTML markup. I am not using much to be honest, just bold, italic and underline.

I want to be able to provide the following.
3 buttons B I U in a word style (no problem)
If a user selects text within the form field and then presses the button...
It inserts, for example, <b> in front of the selected text and </b> after the selected text.

Cant find anything on it. Mostly because no matter what keywords I use for a search it ends up trying to provide me with CMS systems.

All help appreciated...

FPx
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

This forum has this ability (in message editor). It's done via js, so you may open it in text editor and learn from phpbb team work ;)
Post Reply