cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Rauscher <>
Subject cforms problem: Cannot call method "debug" of undefined"
Date Tue, 11 Mar 2008 18:56:46 GMT

hope someone has a solution to this. I'm using cforms and keep getting a

    "org.mozilla.javascript.EcmaError: TypeError: Cannot call method
"debug" of undefined"

error. This is caused by some very basic flowscript in my model which is:

    cocoon.log.debug("some debug message");

It seems like cforms doesn't know it's own environment anymore. The
cocoon variable seems not to be defined. The same happens if I try to
call a function here that is defined in some external flowscript file.
It this case it says the fuction is not defined. From what I've found
out up until now, this is related to several factors:

1. The way the pipeline triggering the cforms (the map:call) is embedded
within other pipelines / subsitemaps
2. Whether or not the widget having the flowscript code attached is
within a union or not

This is my model with the cocoon.log.debug("some debug message") causing
an error:

<fd:form xmlns:fd="">
    <fd:field id="unionCaseSelector">
      <fd:datatype base="string"/>
        <fd:item value="case1"/>
    <fd:union case="unionCaseSelector" id="unionCaseSelector-sel">
        <fd:group id="case1">
            <fd:field required="false" id="case1Member1">
              <fd:label>Union Case 1, Member 1</fd:label>
              <fd:datatype base="string"/>
                  cocoon.log.debug("some debug message");

However, this ONLY causes an error if the union is present. If I change
the model to consist eg. of the case1Member1 widget only, it is working
just fine.

The other factor is in the structure of my sitemaps / pipelines. My
complete structure is:

--- isNotDefinedTest
    --- sitemap.xmap

I have defined the map:call triggering the form instanciation, etc. in
the isNotDefinedTest/sitemap.xmap subsitemap. In my top level sitemap I
have to ways of getting there:
    <!-- calling the form via this pipeline will work -->
    <map:match pattern="subSitemap/**">
      <map:mount uri-prefix="subSitemap"
src="isNotDefinedTest/sitemap.xmap" check-reload="yes"/>

    <!-- calling the form via this pipeline will fail -->
    <map:match pattern="aggregateNotDefinedTest">
      <map:aggregate element="site">
        <map:part src="cocoon:/subSitemap/test"/>
      <map:serialize type="xml"/>

The first one works, the second one fails. However, I need the second one...

Is this a bug? I initially experienced this with Cocoon 2.1.9 (the error
was "cocoon is not defined") but could reproduce it with a freshly build
default 2.1.11 Cocoon where it gives the above error.

I've created a tar file containing the model, template and sitemaps to
reproduce this behaviour. The easiest way is to download this from

and extract the isNotDefinedTest.tar into the build/webapp forlder of a
freshly built cocoon 2.1.11.
NOTE: This will overwrite the top level sitemap.xmap file, so please
save that away in case you need it! Start cocoon and then access the
test setup either via:

http://localhost:8888/subSitemap/test (works)

http://localhost:8888/aggregateNotDefinedTest (fails)

Any ideas on how to best go about this? Please let me know in case you
need anymore info.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message