Welcome Guest, Not a member yet? Register   Sign In
How to create a form?
#1

[eluser]Volkof[/eluser]
Hi guys,

I understand that in forums such as this one where user is posting something, html tags such as bold, underline actually uses [something][/something] and stored into the database as it is.

This is so that when it is retrieved from the database, it is interpreted as html codes and will format according to what is in [something].

Now what I want to ask is how you create such a form for user to write, when they click the <b> button, it will create the [something]

Thanks
#2

[eluser]pickupman[/eluser]
You would need to use javascript to attach to the click event of the element you would be using. When the click the element, the handler can insert the code that you chose to use.
#3

[eluser]PhilTem[/eluser]
Easiest would probably be using some WYSIWYG editor that injects the BBCode into your textarea for editing the content. For displaying you need a BBCode "translator" library.

That's also the terms you should search for "bbcode editor" like e.g. http://wysiwygbbcode.codeplex.com or this http://webcheatsheet.com/javascript/bbcode_editor.php




Theme © iAndrew 2016 - Forum software by © MyBB