Jump to content


Photo

Make submit interact with textarea


  • Please log in to reply
5 replies to this topic

#1 hlstriker

hlstriker
  • Members
  • PipPipPip
  • Advanced Member
  • 84 posts

Posted 09 May 2006 - 01:39 AM

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.

<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>

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!

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 09 May 2006 - 01:44 AM

This sort of thing is done client side using javascript. Do a google for HTMLarea.

#3 hlstriker

hlstriker
  • Members
  • PipPipPip
  • Advanced Member
  • 84 posts

Posted 09 May 2006 - 01:55 AM

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

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 09 May 2006 - 02:14 AM

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.
Legend has it that reading the manual never killed anyone.
My site

#5 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 09 May 2006 - 02:54 AM

[!--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.

#6 khendar

khendar
  • Members
  • PipPipPip
  • Advanced Member
  • 78 posts

Posted 09 May 2006 - 06:39 AM

You could also look into [a href=\"http://www.fckeditor.net/\" target=\"_blank\"]FCKEditor[/a].




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users