CodeIgniter Forums
How to create a form? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to create a form? (/showthread.php?tid=56306)



How to create a form? - El Forum - 12-09-2012

[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


How to create a form? - El Forum - 12-09-2012

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


How to create a form? - El Forum - 12-09-2012

[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