Re: formencode.htmlfill.FillingParser chokes on javascript HTML

Brennan Todd <[email protected]> Wed, 18 Nov 2009 16:50:46 -0600
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
On Wed, Nov 18, 2009 at 2:40 PM, Roy Hyunjin Han
<[email protected]>wrote:

>  Hi,
>
> I am using formencode.htmlfill() to render a form, but the function is
> inadvertently parsing my javascript code.  Specifically,
> formencode.htmlfill.FillingParser raises the following exception
>
>     HTMLParseError: malformed start tag
>
> when it encounters the following jQuery code
>
>     function hover(obj, text) {$(obj).append("<span class=flag> (" + text +
> ")</span>");}
>
> and does not raise the exception after I remove the offending code.
> Perhaps we should strip javascript before htmlfill?
>
> Thanks,
> RHH
>

I find that putting your javascript in HTML comments helps when I run into
the same problem with genshi templates:

<script>
<!--
// your javascript here
-->
</script>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/formencode-discuss