Closed Thread Icon

Topic awaiting preservation: Pre Formater (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12204" title="Pages that link to Topic awaiting preservation: Pre Formater (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Pre Formater <span class="small">(Page 1 of 1)</span>\

 
ASP Newbee Programmer
Nervous Wreck (II) Inmate

From: Carinthia
Insane since: Jan 2002

posted posted 05-08-2002 08:15

I need help!
How do I make a Preformater for a Textarea in ASP or Java Script???

My Problem is, that I have a Textarea and HTML is activated. If somebody types "</table>" into this box, the whole site looks like a piece of shit.

I want to deactivate HTML, but then I need a Pre formater to make the Text formatation.

Please give me some hints to do this.

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 05-08-2002 09:18

Are you looking for something like this? http://www.dmsproject.com/test/wysiwygger/DmSWysiwyg.html
(ps. GRANSKA means preview...)

This is pure javascript and layers (IE only at this point) and it allows the user to add HTML through buttons or by hand.
To stop them from adding "illegal" tags, your best option is probably to combine this with a serverside code to strip all illegal tags.

This is one snippet I had lying around in asp, probably a lot more efficient with some regexp code, however, that's not in my bag of tricks
<BLOCKQUOTE><FONT face="Verdana, Arial">code:</font><HR><pre>
<%
function convertString(byVal inputString)
'function for converting a string before insert into
'Database, it allovs three kinds of HTML tags
'(bold, italic and break row).
dim tmpString
if IsNull(tmpString) then
convertString = tmpString
else
tmpString = inputString
tmpString = Trim(tmpString)
tmpString = Replace(tmpString,"

ASP Newbee Programmer
Nervous Wreck (II) Inmate

From: Carinthia
Insane since: Jan 2002

posted posted 05-08-2002 10:27

I thank for the code. It works perfectly, but I should do like here in ozoneasylum.
If I press enter, it should make a <BR>.
Do you know what I mean???

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 05-08-2002 14:17

tmpString = replace(tmpString, "\n\r","<BR/>")
tmpString = replace(tmpString, "\r\n","<BR/>")
tmpString = replace(tmpString, "\n","<BR/>")

That should do it, you have to watch for newline(linereturn) characters.

ASP Newbee Programmer
Nervous Wreck (II) Inmate

From: Carinthia
Insane since: Jan 2002

posted posted 05-13-2002 16:30

Thanks. It works.

mfg
Edefix

My english isn´t the best,
my knowledge is smaller than the rest

« BackwardsOnwards »

Show Forum Drop Down Menu