Re: [WebDNA] Protect TextArea and other Input-Fields with WebDNA - Something to talk about ;)

This WebDNA talk-list message is from

2009


It keeps the original formatting.
numero = 102719
interpreted = N
texte = --Apple-Mail-4-579541169 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Tom I use this solution as well, and it's working okay. What I have not solved yet is how to make this... http://bytes.com/topic/javascript/answers/437652-list-options-textarea-using-javascript Take a look at how they present code examples. I would love to do it this way with fine lines, lines numbers, and safe from the codes being executes on the pages. Anyone got an idea on how to do this? Palle On 16/06/2009, at 09.23, Tom Duke wrote: > Hi guys, > > Here is what I do - you can see it in action here: > > http://www.foe.ie/blog/2009/05/29/policymaking-21st-century-style-by-tweet/#comments > > I only allow limited HTML - and - > though it could be extended to allow other tags. Basically I grep > and replace the allowed tags and then remove all other HTML. I > don't worry about WebDNA tags as I ensure the input comment is not > wrapped with [interpret]. > > - Tom > > > > So the posted variable is [comment] > > > [table name=basic_conversions&fields=from,to] > && > "" > [/table] > > [text]newvalue=[grep search=<(strong|/strong|em|/em|blockquote|/ > blockquote)>&replace=|\1|][comment][/grep][/text] > [text]newvalue=[grep search=]*)>([^<]*) a>&replace=|a href=\1|\3|/a|][newvalue][/grep][/text] > [text]newvalue=[removehtml][newvalue][/removehtml][/text] > [text]newvalue=[grep search=\|(strong|/strong|em|/em|blockquote|/ > blockquote)\|&replace=<\1>][newvalue][/grep][/text] > [text]newvalue=[grep search=\|a href=([^\|]*)\|([^\|]*)\|/a\| > &replace=\2][newvalue][/grep][/text] > [text]newvalue=[unurl][grep search=%250A&replace=][url][newvalue][/ > url][/grep][/unurl][/text] > [text]newvalue=[grep search=%0D%0D&replace=

][newvalue][/grep] > [/text] > [text]newvalue=[grep search=%0D&replace=
][newvalue][/grep][/ > text] > [text]newvalue=[convertchars table=basic_conversions][newvalue][/ > convertchars][/text] > > The cleaned variable is then displayed and stored as: > >

[newvalue]

> > --Apple-Mail-4-579541169 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable
Tom I use this solution as = well, and it's working okay.

What I have not = solved yet is how to make this...

http://bytes.com/topic/javascript/answers/437652-li= st-options-textarea-using-javascript

Take a = look at how they present code examples. I would love to do it this way = with fine lines, lines numbers, and safe from the codes being executes = on the pages.

Anyone got an idea on how to do = this?

Palle


On = 16/06/2009, at 09.23, Tom Duke wrote:

Hi = guys,

Here is what I do - you can see it in action = here:


I only = allow limited HTML - <strong> <em> and <a = href=3D""></a> - though it could be extended to allow other = tags.  Basically I grep and replace the allowed tags and then = remove all other HTML.  I don't worry about WebDNA tags as I ensure = the input comment is not wrapped with [interpret]. =

- = Tom



So the posted = variable is [comment]


[table = name=3Dbasic_conversions&fields=3Dfrom,to]
&&amp;
"&quot;
[/table]

[text]newvalue=3D[grep = search=3D<(strong|/strong|em|/em|blockquote|/blockquote)>&replac= e=3D|\1|][comment][/grep][/text]
[text]newvalue=3D[grep search=3D<a = href=3D"([^"]*)"([^>]*)>([^<]*)</a>&replace=3D|a = href=3D\1|\3|/a|][newvalue][/grep][/text]
[text]newvalue=3D[removehtml][newvalue][/removehtml][/text]
[text]newvalue=3D[grep = search=3D\|(strong|/strong|em|/em|blockquote|/blockquote)\|&replace=3D= <\1>][newvalue][/grep][/text]
[text]newvalue=3D[grep search=3D\|a = href=3D([^\|]*)\|([^\|]*)\|/a\|&replace=3D<a = href=3D"\1">\2</a>][newvalue][/grep][/text]
=
[text]newvalue=3D[unurl][grep = search=3D%250A&replace=3D][url][newvalue][/url][/grep][/unurl][/text]<= /font>
[text]newvalue=3D[grep = search=3D%0D%0D&replace=3D</p><p>][newvalue][/grep][/text]=
[text]newvalue=3D[grep = search=3D%0D&replace=3D<br = />][newvalue][/grep][/text]
[text]newvalue=3D[convertchars = table=3Dbasic_conversions][newvalue][/convertchars][/text]
=

The cleaned variable is then = displayed and stored as:

   = <p>[newvalue]</p>

=


= --Apple-Mail-4-579541169-- Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Protect TextArea and other Input-Fields with WebDNA - Something to talk about ;) (Palle Bo Nielsen 2009)
--Apple-Mail-4-579541169 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Tom I use this solution as well, and it's working okay. What I have not solved yet is how to make this... http://bytes.com/topic/javascript/answers/437652-list-options-textarea-using-javascript Take a look at how they present code examples. I would love to do it this way with fine lines, lines numbers, and safe from the codes being executes on the pages. Anyone got an idea on how to do this? Palle On 16/06/2009, at 09.23, Tom Duke wrote: > Hi guys, > > Here is what I do - you can see it in action here: > > http://www.foe.ie/blog/2009/05/29/policymaking-21st-century-style-by-tweet/#comments > > I only allow limited HTML - and - > though it could be extended to allow other tags. Basically I grep > and replace the allowed tags and then remove all other HTML. I > don't worry about WebDNA tags as I ensure the input comment is not > wrapped with [interpret]. > > - Tom > > > > So the posted variable is [comment] > > > [table name=basic_conversions&fields=from,to] > && > "" > [/table] > > [text]newvalue=[grep search=<(strong|/strong|em|/em|blockquote|/ > blockquote)>&replace=|\1|][comment][/grep][/text] > [text]newvalue=[grep search=]*)>([^<]*) a>&replace=|a href=\1|\3|/a|][newvalue][/grep][/text] > [text]newvalue=[removehtml][newvalue][/removehtml][/text] > [text]newvalue=[grep search=\|(strong|/strong|em|/em|blockquote|/ > blockquote)\|&replace=<\1>][newvalue][/grep][/text] > [text]newvalue=[grep search=\|a href=([^\|]*)\|([^\|]*)\|/a\| > &replace=\2][newvalue][/grep][/text] > [text]newvalue=[unurl][grep search=%250A&replace=][url][newvalue][/ > url][/grep][/unurl][/text] > [text]newvalue=[grep search=%0D%0D&replace=

][newvalue][/grep] > [/text] > [text]newvalue=[grep search=%0D&replace=
][newvalue][/grep][/ > text] > [text]newvalue=[convertchars table=basic_conversions][newvalue][/ > convertchars][/text] > > The cleaned variable is then displayed and stored as: > >

[newvalue]

> > --Apple-Mail-4-579541169 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable
Tom I use this solution as = well, and it's working okay.

What I have not = solved yet is how to make this...


Take a = look at how they present code examples. I would love to do it this way = with fine lines, lines numbers, and safe from the codes being executes = on the pages.

Anyone got an idea on how to do = this?

Palle


On = 16/06/2009, at 09.23, Tom Duke wrote:

Hi = guys,

Here is what I do - you can see it in action = here:


I only = allow limited HTML - <strong> <em> and <a = href=3D""></a> - though it could be extended to allow other = tags.  Basically I grep and replace the allowed tags and then = remove all other HTML.  I don't worry about WebDNA tags as I ensure = the input comment is not wrapped with [interpret]. =

- = Tom



So the posted = variable is [comment]


[table = name=3Dbasic_conversions&fields=3Dfrom,to]
&&amp;
"&quot;
[/table]

[text]newvalue=3D[grep = search=3D<(strong|/strong|em|/em|blockquote|/blockquote)>&replac= e=3D|\1|][comment][/grep][/text]
[text]newvalue=3D[grep search=3D<a = href=3D"([^"]*)"([^>]*)>([^<]*)</a>&replace=3D|a = href=3D\1|\3|/a|][newvalue][/grep][/text]
[text]newvalue=3D[removehtml][newvalue][/removehtml][/text]
[text]newvalue=3D[grep = search=3D\|(strong|/strong|em|/em|blockquote|/blockquote)\|&replace=3D= <\1>][newvalue][/grep][/text]
[text]newvalue=3D[grep search=3D\|a = href=3D([^\|]*)\|([^\|]*)\|/a\|&replace=3D<a = href=3D"\1">\2</a>][newvalue][/grep][/text]
=
[text]newvalue=3D[unurl][grep = search=3D%250A&replace=3D][url][newvalue][/url][/grep][/unurl][/text]<= /font>
[text]newvalue=3D[grep = search=3D%0D%0D&replace=3D</p><p>][newvalue][/grep][/text]=
[text]newvalue=3D[grep = search=3D%0D&replace=3D<br = />][newvalue][/grep][/text]
[text]newvalue=3D[convertchars = table=3Dbasic_conversions][newvalue][/convertchars][/text]
=

The cleaned variable is then = displayed and stored as:

   = <p>[newvalue]</p>

=


= --Apple-Mail-4-579541169-- Palle Bo Nielsen

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

emailer don't work (1998) Help! WebCat2 bug (Ben's input) (1997) bug in [SendMail] (1997) Cookie setting (2003) Re1000001: Setting up shop (1997) Am I going senile? (Price recalc based on quantity) (1997) Purchased cart being overwritten - still !?? (1997) MacWEEK article help needed (1996) Any limit to [include] (1997) World Address Info (2003) WebCat2 - many [carts] on one template page? (1997) [WebDNA] Problem with SendMail - seems succesfull but nothing to recieve (2016) Uploading Files (2000) ShowIf helper? (1998) [format 40s]text[/format] doesn't work (1997) Stopping NT WebCat service (1998) pictures / referrer etc. (1998) Checking Out! (1999) [WebDNA] No more SQL in 7.1? (2012) WebCatalog can't find database (1997)