cocoon-users mailing list archives

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

<!DOCTYPE page PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


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


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

based on:

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

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" />
          </xsl:if>
        </xsl:when>

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.

regards

Andrew

Mime
View raw message