cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew <>
Subject Xhtml serialized document with ajax="true" results in 'cocoon not defined'
Date Fri, 21 Jul 2006 11:58:58 GMT
I have an xhtml document:

<!DOCTYPE page PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

which uses, or is trying to use!, ajax. When ajax is declared as
"true", transformation/serialization yields the following (x)html

<form action="login.kont" ajax="true" name="Form1" method="POST"
<script>cocoon.forms.ajax = true;</script>

based on:

                <map:select type="ajax-request">
                  <map:when test="true">
                    <map:serialize type="xml"/>
                    <map:serialize type="xhtml"/> <!------------ This line
right here is the trouble maker!!

Now that little bit of javascript, <script>cocoon.forms.ajax = true;</script>,
results in your page being broken, by that I mean the page is displayed
incorrectly (well in my case it is!), if you serialise your document as
xhtml. So I changed the code in forms-field-styling.xsl to read as:

        <xsl:when test="@ajax = 'true'">
          <xsl:attribute name="dojoType">CFormsForm</xsl:attribute>
          <xsl:if test="@ajax = 'true'">
           <!--<script>cocoon.forms.ajax = true;</script>-->
           <script type="text/javascript" src="resources/dojo_ajax.js" />

There is one single line of js in dojo_ajax.js which is cocoon.forms.ajax =
true;. The page renders correctly with this, but now I have an error,
reported by FireBug, which says 'cocoon is not defined'! Is there a solution
to this you .js gurus may be aware of that will resolve this? And before you
say serialize the doc as html, I need it serialized as xhtml.



View raw message