Jump to content

Archived

This topic is now archived and is closed to further replies.

hlstriker

Make submit interact with textarea

Recommended Posts

Hello everyone, I am trying to make something like the forums where you are making a thread and there are the Bold, Italic, Underline, Quote, etc buttons that add stuff to the textarea.

So far I have my form all ready, but I don't even know where to start to make the buttons interact with the textarea. I figured this would be using PHP too, but i'm not to sure.

Here is the code I have so far, and am wondering if someone could change this to make the buttons work with the textarea, and explain what it does.

[code]<form name="newssubmit" action="BLAHBLAHBLAH" method="POST">
<table border="1" cellspacing="0" cellpadding="5"><tr><td>

<input type="text" name="title" value="Enter News Title" size="38"></td></tr>

<tr><td>
        <input type="submit" name="bold" value="B">
        <input type="submit" name="italic" value="i">
        <input type="submit" name="underline" value="u">
        <input type="submit" name="break" value="Break">
        <input type="submit" name="quote" value="Quote">
        <input type="submit" name="image" value="Img">
        <input type="submit" name="url" value="URL">
</td></tr>

<tr><td>
        <textarea cols="58" rows="15" name="text">
        Enter news here.
        </textarea>
</td></tr>

<tr><td>
<input type="submit" name="add" value="Add News"><br>
</td></tr>

</table>
</form>[/code]

So for example, the user should be able to enter text in the textarea, then highlight the text, push a Bold (or other) button, and it will put the bold html tags around it.

Thanks in advance!

Share this post


Link to post
Share on other sites
This sort of thing is done client side using javascript. Do a google for HTMLarea.

Share this post


Link to post
Share on other sites
Alright, thanks alot, but what exactly am I supposed to look for there?

Sorry, was going around that website wondering what it would be :P

Share this post


Link to post
Share on other sites
Not sure if HTMLarea is still available for free ... but TinyMCE is free from [a href=\"http://tinymce.moxiecode.com/\" target=\"_blank\"]http://tinymce.moxiecode.com/[/a]. It's a simple javascript textarea editor.

Share this post


Link to post
Share on other sites
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]TinyMCE is free from [a href=\"http://tinymce.moxiecode.com/\" target=\"_blank\"]http://tinymce.moxiecode.com/[/a].[/quote]
Ahh.... thats the one I was thinking of anyways. Been so long since Ive done any web work that I'de forgotten what It was called.

Share this post


Link to post
Share on other sites
You could also look into [a href=\"http://www.fckeditor.net/\" target=\"_blank\"]FCKEditor[/a].

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.