[thelist] ColdFusion and checking HTML

Joshua Olson joshua at alphashop.net
Wed Apr 25 20:09:13 CDT 2001


Hmmm... interesting problem.  Unfortunately, the algorithm you mentioned
will not be enough to solve the problem, though it will get close.  If you
are happy with close, then yes, the loop can be constructed.  It'll be slow
as h**l in ColdFusion, but it can be done.

Try converting the string to an array using > is the delimiter.  Then loop
through the array checking the items against your checklist.

-joshua

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> Subject: [thelist] ColdFusion and checking HTML
>
>
> Hi,
>
> I'm in quote a dilemma. (not a good way to start off is it :-) )
> Hopefully some skilled CFer can help.
>
> I need to check an array full of strings for non-html text. That is, I
> want to check to see if the text in the array would show something when
> viewed in a browser or not. For example this should pass the
> validation:
>
> myarray[1]="<p class=blah style=blah>text</p><span id=blah
> style=blah>&nbsp;</span><img src=blah>"
>
> But this should NOT be allowed:
>
> myarray[2]="<p class=blah style=blah>&nbsp;</p><span></span>"
>
> Since when viewed in a browser, the above code would show a blank page.
>
> Is there an easy function which checks this?
>
> If not can someone help me in developing a loop which will check every
> instance of ">", then verify that the next character is not "<", the
> next 6 characters are not "&nbsp;", but allow it if the next 4
> characters are "<img".
>
> Thank you. I tried this but could not get it. I was able to do it in
> JavaScript, so there's gotta be a way in ColdFusion.
>
> Jon.





More information about the thelist mailing list