You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Andrew <an...@gmail.com> on 2006/07/21 13:58:58 UTC

Xhtml serialized document with ajax="true" results in 'cocoon not defined'

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

Re: Xhtml serialized document with ajax="true" results in 'cocoon not defined'

Posted by Andrew <an...@gmail.com>.
SOLVED: This issue has been resolved.

Andrew

On 21/07/06, Andrew <an...@gmail.com> wrote:
>
> 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
>