Thanks! Worked perfectly. I have a couple more updates to make. I am wondering if you would like me to post this on the documentation site because I think it would be helpful.

--Seth
On Sep 26, 2007, at 5:43 AM, Dennis Dam wrote:

Seth,

Can you move the following section:

      <group type="container">
         <macro-call id="repeater-header">
<param name="path">/root/questions/question/answers/ answer</param>
         </macro-call>
         <display id="/root/questions/question/answers/answer"/>
       </group>


into the

<template name="/root/questions/question">
 ..
</template>

what happens is that you try to access a field (/root/questions/ question/answers/answer) out of context (/root/questions/question), resulting in a NPE.

regards,
Dennis

Seth Gottlieb wrote:
Thanks for looking into this.  See below for the outputs.

Thanks,

Seth
===================
/editing/cf2/model/quiz
===================
<fd:form>
−
    <fd:widgets>
−
    <fd:output id="CFormsEditorMessageWidget">
<fd:datatype base="string"/>
</fd:output>
−
    <fd:output id="CFormsEditorValidationMessageWidget">
<fd:datatype base="string"/>
</fd:output>
−
    <fd:field id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxtitle">
−
    <fd:label>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.title">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
</fd:label>
−
    <fd:help>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.help.root.title"/>
</i18n:translate>
</fd:help>
−
    <fd:validation>
−
    <fd:length min="1" max="100">
−
    <fd:failmessage>
<i18n:text>..root.title</i18n:text>
</fd:failmessage>
</fd:length>
</fd:validation>
<fd:datatype base="string"/>
</fd:field>
−
    <fd:field id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxalttitle">
−
    <fd:label>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.alttitle">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
</fd:label>
−
    <fd:help>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.help.root.alttitle"/>
</i18n:translate>
</fd:help>
−
    <fd:validation>
−
    <fd:length min="0" max="50">
−
    <fd:failmessage>
<i18n:text>..root.alttitle</i18n:text>
</fd:failmessage>
</fd:length>
</fd:validation>
<fd:datatype base="string"/>
</fd:field>
−
    <fd:field id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxurl">
−
    <fd:label>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.url">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
</fd:label>
−
    <fd:help>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.help.root.url"/>
</i18n:translate>
</fd:help>
<fd:validation/>
<fd:datatype base="string"/>
</fd:field>
−
    <fd:field id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxbody">
−
    <fd:label>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.body">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
</fd:label>
−
    <fd:help>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.help.root.body"/>
</i18n:translate>
</fd:help>
<fd:validation/>
−
    <fd:datatype base="string">
<fd:convertor type="htmlcleaner" config="cocoon://editing/cf2/ HtmlCleanerConfiguration.xml"/>
</fd:datatype>
</fd:field>
−
<fd:multivaluefield id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxkeywords">
−
    <fd:label>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.keywords">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
</fd:label>
−
    <fd:help>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.help.root.keywords"/>
</i18n:translate>
</fd:help>
<fd:validation/>
<fd:datatype base="string"/>
−
    <fd:selection-list>
−
    <fd:item value="">
<fd:label>Choose ..</fd:label>
</fd:item>
−
    <fd:item value="Zygotes">
<fd:label>Zygotes</fd:label>
</fd:item>
−
    <fd:item value="Babies">
<fd:label>Babies</fd:label>
</fd:item>
−
    <fd:item value="Kids">
<fd:label>Kids</fd:label>
</fd:item>
−
    <fd:item value="Teenagers">
<fd:label>Teenagers</fd:label>
</fd:item>
</fd:selection-list>
</fd:multivaluefield>
−
    <fd:field id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxpicture">
−
    <fd:label>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.picture">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
</fd:label>
−
    <fd:help>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.help.root.picture"/>
</i18n:translate>
</fd:help>
<fd:validation/>
<fd:datatype base="string"/>
</fd:field>
−
<fd:repeater id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzrepeat" min-size="1">
−
    <fd:widgets>
−
<fd:field id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxquestionBody">
−
    <fd:label>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.questions.question.questionBody">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
</fd:label>
−
    <fd:help>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.help.root.questions.question.questionBody"/>
</i18n:translate>
</fd:help>
<fd:validation/>
<fd:datatype base="string"/>
</fd:field>
−
<fd:field id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxquestionExplanation">
−
    <fd:label>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.questions.question.questionExplanation ">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
</fd:label>
−
    <fd:help>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.help.root.questions.question.questionExplanation"/ >
</i18n:translate>
</fd:help>
<fd:validation/>
<fd:datatype base="string"/>
</fd:field>
−
<fd:repeater id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzrepeat" min- size="1">
−
    <fd:widgets>
−
<fd:field id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerxxxxxxxxxxxxxxanswerBody">
−
    <fd:label>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.questions.question.answers.answer.answ erBody">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
</fd:label>
−
    <fd:help>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.help.root.questions.question.answers.answer.answer Body"/>
</i18n:translate>
</fd:help>
<fd:validation/>
<fd:datatype base="string"/>
</fd:field>
−
<fd:booleanfield id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerxxxxxxxxxxxxxxcorrect">
−
    <fd:label>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.questions.question.answers.answer.corr ect">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
</fd:label>
−
    <fd:help>
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.help.root.questions.question.answers.answer.correc t"/>
</i18n:translate>
</fd:help>
<fd:validation/>
<fd:datatype base="boolean"/>
</fd:booleanfield>
−
<fd:row-action action-command="add-after" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzcrepeataddafter ">
−
    <fd:label>
Add new
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.questions.question.answers.answer">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
 after ..
</fd:label>
<fd:help/>
−
    <fd:on-action>
−
    <fd:javascript>

            var form = event.source.form;

                form.setAttribute("activeElement", event.source);
                form.setAttribute("gotoFirst", "true");

            form.setAttribute("action", "add-after");

</fd:javascript>
</fd:on-action>
</fd:row-action>
−
<fd:row-action action-command="delete" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzcrepeatdelete">
<fd:label>Delete</fd:label>
<fd:help/>
−
    <fd:on-action>
−
    <fd:javascript>

            var form = event.source.form;


                var w = event.source;
                var thisIndex = w.getParent().getId();
while (w != null && w.getClass().getName() != "org.apache.cocoon.forms.formmodel.Repeater")
                   w = w.getParent();
                if (w != null){
                  form.setAttribute("activeElement", w);
                  form.setAttribute("activeRow", thisIndex - 1);
                }


            form.setAttribute("action", "delete");

</fd:javascript>
</fd:on-action>
</fd:row-action>
−
<fd:row-action action-command="move-up" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzcrepeatmoveup">
<fd:label>Move up</fd:label>
<fd:help/>
−
    <fd:on-action>
−
    <fd:javascript>

            var form = event.source.form;

                form.setAttribute("activeElement", event.source);
                form.setAttribute("gotoFirst", "true");

            form.setAttribute("action", "move-up");

</fd:javascript>
</fd:on-action>
</fd:row-action>
−
<fd:row-action action-command="move-down" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzcrepeatmovedown ">
<fd:label>Move down</fd:label>
<fd:help/>
−
    <fd:on-action>
−
    <fd:javascript>

            var form = event.source.form;

                form.setAttribute("activeElement", event.source);
                form.setAttribute("gotoFirst", "true");

            form.setAttribute("action", "move-down");

</fd:javascript>
</fd:on-action>
</fd:row-action>
−
<fd:booleanfield id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzcrepeatselect">
<fd:label>Select row</fd:label>
</fd:booleanfield>
</fd:widgets>
</fd:repeater>
−
<fd:repeater-action id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzcrepeatadd" action-command="add-row" repeater="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxques tionxxxxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzrepeat">
−
    <fd:label>
Add new
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.questions.question.answers.answer">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
</fd:label>
<fd:help/>
−
    <fd:on-action>
−
    <fd:javascript>

            var form = event.source.form;

                form.setAttribute("activeElement", event.source);
form.setAttribute ("activeRow",event.source.getRepeater().getSize()-1);

            form.setAttribute("action", "add-row");

</fd:javascript>
</fd:on-action>
</fd:repeater-action>
−
<fd:repeater-action id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzcrepeatdeletero ws" action-command="delete-rows" repeater="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxques tionxxxxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzrepeat" s elect="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestio nxxxxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzcrepeatselec t">
−
    <fd:label>
Delete selected
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.questions.question.answers.answer">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
</fd:label>
<fd:help/>
−
    <fd:on-action>
−
    <fd:javascript>

            var form = event.source.form;

                form.setAttribute("activeElement", event.source);

            form.setAttribute("action", "delete-rows");

</fd:javascript>
</fd:on-action>
</fd:repeater-action>
−
<fd:row-action action-command="add-after" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzcrepeataddafter">
−
    <fd:label>
Add new
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.questions.question">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
 after ..
</fd:label>
<fd:help/>
−
    <fd:on-action>
−
    <fd:javascript>

            var form = event.source.form;

                form.setAttribute("activeElement", event.source);
                form.setAttribute("gotoFirst", "true");

            form.setAttribute("action", "add-after");

</fd:javascript>
</fd:on-action>
</fd:row-action>
−
<fd:row-action action-command="delete" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzcrepeatdelete">
<fd:label>Delete</fd:label>
<fd:help/>
−
    <fd:on-action>
−
    <fd:javascript>

            var form = event.source.form;


                var w = event.source;
                var thisIndex = w.getParent().getId();
while (w != null && w.getClass().getName() != "org.apache.cocoon.forms.formmodel.Repeater")
                   w = w.getParent();
                if (w != null){
                  form.setAttribute("activeElement", w);
                  form.setAttribute("activeRow", thisIndex - 1);
                }


            form.setAttribute("action", "delete");

</fd:javascript>
</fd:on-action>
</fd:row-action>
−
<fd:row-action action-command="move-up" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzcrepeatmoveup">
<fd:label>Move up</fd:label>
<fd:help/>
−
    <fd:on-action>
−
    <fd:javascript>

            var form = event.source.form;

                form.setAttribute("activeElement", event.source);
                form.setAttribute("gotoFirst", "true");

            form.setAttribute("action", "move-up");

</fd:javascript>
</fd:on-action>
</fd:row-action>
−
<fd:row-action action-command="move-down" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzcrepeatmovedown">
<fd:label>Move down</fd:label>
<fd:help/>
−
    <fd:on-action>
−
    <fd:javascript>

            var form = event.source.form;

                form.setAttribute("activeElement", event.source);
                form.setAttribute("gotoFirst", "true");

            form.setAttribute("action", "move-down");

</fd:javascript>
</fd:on-action>
</fd:row-action>
−
<fd:booleanfield id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzcrepeatselect">
<fd:label>Select row</fd:label>
</fd:booleanfield>
</fd:widgets>
</fd:repeater>
−
<fd:repeater-action id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzcrepeatadd" action-command="add-row" repeater="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxques tionzzzzzzzzzzzzzzzrepeat">
−
    <fd:label>
Add new
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.questions.question">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
</fd:label>
<fd:help/>
−
    <fd:on-action>
−
    <fd:javascript>

            var form = event.source.form;

                form.setAttribute("activeElement", event.source);
form.setAttribute ("activeRow",event.source.getRepeater().getSize()-1);

            form.setAttribute("action", "add-row");

</fd:javascript>
</fd:on-action>
</fd:repeater-action>
−
<fd:repeater-action id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzcrepeatdeleterows" action-command="delete-rows" repeater="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxques tionzzzzzzzzzzzzzzzrepeat" select="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquesti onzzzzzzzzzzzzzzzcrepeatselect">
−
    <fd:label>
Delete selected
−
    <i18n:translate>
<i18n:text i18n:key="cms.demo.fields.root.questions.question">
            {0}
          </i18n:text>
−
    <i18n:param>
<i18n:text>cms.cforms-editor.field.nolabel</i18n:text>
</i18n:param>
</i18n:translate>
</fd:label>
<fd:help/>
−
    <fd:on-action>
−
    <fd:javascript>

            var form = event.source.form;

                form.setAttribute("activeElement", event.source);

            form.setAttribute("action", "delete-rows");

</fd:javascript>
</fd:on-action>
</fd:repeater-action>
</fd:widgets>
</fd:form>


=====================
 /editing/cf2/template/quiz
=====================
 <ft:form-template action="/editing/cf2/continue" method="POST">
<ft:continuation-id/>
−
    <libs>
<lib src="/editing/cf2/js/htmlarea.js"/>
</libs>
−
    <hc:template name="/">
−
    <ft:widget id="CFormsEditorMessageWidget">
<fi:styling type="messages" class="demoMessages" i18n- prefix="cms.cforms-editor.messages"/>
</ft:widget>
−
    <ft:widget id="CFormsEditorValidationMessageWidget">
<fi:styling type="validationmessages" class="demoValidationMessages" i18n-prefix="cms.cforms- editor.general-validation-messages"/>
</ft:widget>
−
    <fi:group>
<fi:styling class="" subtype="" layout="columns"/>
−
    <fi:items>
−
    <ft:widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxtitle">
<fi:styling class="textfield "/>
</ft:widget>
−
    <ft:widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxalttitle">
<fi:styling class="textfield "/>
</ft:widget>
−
    <ft:widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxkeywords">
<fi:styling class="selectgroup " listbox-size="" list- type="listbox"/>
</ft:widget>
−
    <ft:widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxurl">
<fi:styling class="textfield "/>
</ft:widget>
−
    <ft:widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxpicture">
<fi:styling input-class="picturepreview " caption="" picker- class="" picker-reset-icon="" picker-icon="" picker-id="asset" div- class="" type="picturepreview" pic-height="50"/>
</ft:widget>
−
    <ft:widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxbody">
−
    <fi:styling class="htmlfield myDemoHtmlArea" type="htmlarea">
<initFunction>myDemoHtmlArea</initFunction>
</fi:styling>
</ft:widget>
−
    <fi:group>
<fi:styling class="" subtype="" layout="container"/>
−
    <fi:items>
−
    <table class=" layout-grid-table" width="100%">
−
    <tr class="layout-grid-table-row-odd">
<td class="">  </td>
−
    <td class="">
−
<ft:widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzcrepeatadd">
−
    <fi:styling class="" type="">
−
    <hc:action-info>
<hc:action>add</hc:action>
−
    <hc:repeater>
xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzzzzzz zzzzzzzzzrepeat
</hc:repeater>
</hc:action-info>
</fi:styling>
</ft:widget>
</td>
</tr>
</table>
−
<ft:class id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzrepeatclass">
<hc:repeater id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzrepeat"> <ft:repeater-size id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzrepeat"/>
<ft:repeater-widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzrepeat">
<hc:repeater-row repeater- id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzrepeat">
−
    <hc:template name="/root/questions/question">
−
    <tr class="layout-gridrow-row ">
−
    <td align="" valign="" colspan="2" class="">
−
<ft:widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzcrepeatdelete">
−
    <fi:styling class="" type="">
−
    <hc:action-info>
<hc:action>delete</hc:action>
−
    <hc:repeater>
xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzzzzzz zzzzzzzzzrepeat
</hc:repeater>
</hc:action-info>
</fi:styling>
</ft:widget>
</td>
</tr>
−
<ft:widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxquestionBody">
−
    <fi:styling class="htmlfield myDemoHtmlArea" type="htmlarea">
<initFunction>myDemoHtmlArea</initFunction>
</fi:styling>
</ft:widget>
−
<ft:widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxquestionExplanation">
−
    <fi:styling class="htmlfield myDemoHtmlArea" type="htmlarea">
<initFunction>myDemoHtmlArea</initFunction>
</fi:styling>
</ft:widget>
</hc:template>
</hc:repeater-row>
</ft:repeater-widget>
</hc:repeater>
</ft:class>
<ft:new id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzrepeatclass"/>
−
    <fi:group>
<fi:styling class="" subtype="" layout="container"/>
−
    <fi:items>
−
    <table class=" layout-grid-table" width="100%">
−
    <tr class="layout-grid-table-row-odd">
<td class="">  </td>
−
    <td class="">
−
<ft:widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzcrepeatadd">
−
    <fi:styling class="" type="">
−
    <hc:action-info>
<hc:action>add</hc:action>
−
    <hc:repeater>
xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxxxxxx xxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzrepeat
</hc:repeater>
</hc:action-info>
</fi:styling>
</ft:widget>
</td>
</tr>
</table>
−
<ft:class id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzrepeatclass">
<hc:repeater id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzrepeat"> <ft:repeater-size id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzrepeat"/>
<ft:repeater-widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzrepeat">
<hc:repeater-row repeater- id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzrepeat">
−
    <hc:template name="/root/questions/question/answers/answer">
−
    <tr class="layout-gridrow-row ">
−
    <td align="" valign="" colspan="2" class="">
−
<ft:widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzcrepeatdelete">
−
    <fi:styling class="" type="">
−
    <hc:action-info>
<hc:action>delete</hc:action>
−
    <hc:repeater>
xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxxxxxx xxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzrepeat
</hc:repeater>
</hc:action-info>
</fi:styling>
</ft:widget>
</td>
</tr>
−
<ft:widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerxxxxxxxxxxxxxxanswerBody">
−
    <fi:styling class="htmlfield myDemoHtmlArea" type="htmlarea">
<initFunction>myDemoHtmlArea</initFunction>
</fi:styling>
</ft:widget>
−
<ft:widget id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerxxxxxxxxxxxxxxcorrect">
<fi:styling class="checkbox "/>
</ft:widget>
</hc:template>
</hc:repeater-row>
</ft:repeater-widget>
</hc:repeater>
</ft:class>
<ft:new id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzrepeatclass"/>
</fi:items>
</fi:group>
</fi:items>
</fi:group>
</fi:items>
</fi:group>
</hc:template>
</ft:form-template>

===========================
/editing/cf2/binding/quiz
===========================

<fb:context path="/">
−
    <fb:context path="root">
<fb:value path="title" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxtitle"/>
<fb:value path="alttitle" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxalttitle"/>
<fb:value path="url" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxurl"/>
<fb:custom class="nl.hippo.cocoon.forms.binding.HTMLAreaBinding" path="body" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxbody"/> <fb:multi-value row-path="keywords" parent-path="." id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxkeywords"/> <fb:value path="picture" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxpicture"/>
−
    <fb:context path="questions">
−
<fb:repeater row-path="question" parent-path="." id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionzz zzzzzzzzzzzzzrepeat">
−
    <fb:on-bind>
<fb:value path="questionBody" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxquestionBody"/> <fb:value path="questionExplanation" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxquestionExplanation"/>
−
    <fb:context path="answers">
−
<fb:repeater row-path="answer" parent-path="." id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerzzzzzzzzzzzzzzzrepeat">
−
    <fb:on-bind>
<fb:value path="answerBody" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerxxxxxxxxxxxxxxanswerBody"/>
<fb:value path="correct" id="xxxxxxxxxxxxxxrootxxxxxxxxxxxxxxquestionsxxxxxxxxxxxxxxquestionxx xxxxxxxxxxxxanswersxxxxxxxxxxxxxxanswerxxxxxxxxxxxxxxcorrect">
<fd:convertor datatype="boolean"/>
</fb:value>
</fb:on-bind>
−
    <fb:on-delete-row>
<fb:delete-node/>
</fb:on-delete-row>
−
    <fb:on-insert-row>
−
    <fb:insert-node>
−
    <answer>
<answerBody/>
</answer>
</fb:insert-node>
</fb:on-insert-row>
</fb:repeater>
</fb:context>
</fb:on-bind>
−
    <fb:on-delete-row>
<fb:delete-node/>
</fb:on-delete-row>
−
    <fb:on-insert-row>
−
    <fb:insert-node>
−
    <question>
<questionBody/>
</question>
</fb:insert-node>
</fb:on-insert-row>
</fb:repeater>
</fb:context>
</fb:context>
</fb:context>

On Sep 25, 2007, at 4:03 AM, Dennis Dam wrote:

Seth,

at first sight the schema / layout look consistent. Can you post the following output to this list as well?

- /editing/cf2/model/quiz
- /editing/cf2/template/quiz
- /editing/cf2/binding/quiz

?

thanks,
Dennis

Seth Gottlieb wrote:
Hello,

I am trying to model a 3 level complex content type of a "quiz" that can have multiple questions and each question can have multiple answers with one of the answers being correct. When I try editing a document of type quiz, I get a big stack trace that says it was caused by a NPE. Here is the trace:

org.apache.cocoon.ProcessingException: Failed to process pipeline at <map:serialize type="html"> - file:/opt/local/hippo/ hippo-cms-v6.04.02/cocoon/../sites/hippo-cms/editing/cf2/ sitemap.xmap:500:36 at <map:transform type="i18n"> - file:/opt/ local/hippo/hippo-cms-v6.04.02/cocoon/../sites/hippo-cms/editing/ cf2/sitemap.xmap:496:35 at <map:transform> - file:/opt/local/ hippo/hippo-cms-v6.04.02/cocoon/../sites/hippo-cms/editing/cf2/ sitemap.xmap:491:70 at <map:transform> - file:/opt/local/hippo/ hippo-cms-v6.04.02/cocoon/../sites/hippo-cms/editing/cf2/ sitemap.xmap:490:54 at <map:transform type="i18n"> - file:/opt/ local/hippo/hippo-cms-v6.04.02/cocoon/../sites/hippo-cms/editing/ cf2/sitemap.xmap:487:55 at <map:transform type="forms"> - file:/ opt/local/hippo/hippo-cms-v6.04.02/cocoon/../sites/hippo-cms/ editing/cf2/sitemap.xmap:484:36 at file:/opt/local/hippo/hippo- cms-v6.04.02/cocoon/../sites/hippo-cms/editing/cf2/flow/ HippoForm.js:158:-1 at file:/opt/local/hippo/hippo-cms-v6.04.02/ cocoon/../sites/hippo-cms/editing/cf2/flow/flow.js:96:-1 at file:/opt/local/hippo/hippo-cms-v6.04.02/cocoon/../sites/hippo- cms/editing/cf2/flow/HippoForm.js:308:-1 at <map:call> - file:/ opt/local/hippo/hippo-cms-v6.04.02/cocoon/../sites/hippo-cms/ editing/cf2/sitemap.xmap:508:41 at <map:mount> - file:/opt/local/ hippo/hippo-cms-v6.04.02/cocoon/../sites/hippo-cms/editing/ sitemap.xmap:42:62 at <map:mount> - file:/opt/local/hippo/hippo- cms-v6.04.02/cocoon/../sites/hippo-cms/sitemap.xmap:338:54 at <map:mount> - file:/opt/local/hippo/hippo-cms-v6.04.02/cocoon/ sitemap.xmap:127:59

Now, after tweaking some more, the edit form is blank but I can still get the stack traces from the source.

I checked http://localhost:50000/editing/cf2/validity-test/index and it appeared to check out OK.

What log files should I be looking in to diagnose these issues? I have a feeling that the issue is in the nesting of groups is my layout.xml file:

 <group type="container">
        <macro-call id="repeater-header">
          <param name="path">/root/questions/question</param>
        </macro-call>
        <display id="/root/questions/question"/>
        <group type="container">
          <macro-call id="repeater-header">
<param name="path">/root/questions/question/answers/ answer</param>
          </macro-call>
          <display id="/root/questions/question/answers/answer"/>
        </group>
    </group>


See below for a full listing from all the files.

Thanks,

Seth



========================
quiz.xml
========================

<root>
  <title/>
  <alttitle> </alttitle>
  <url> </url>
  <body> </body>
  <questions>
    <question>
      <questionBody/>
      <questionExplanation/>
      <answers>
        <answer>
        <answerBody/>
        <correct/>
        </answer>
      </answers>
    </question>
  </questions>

</root>
========================
quiz.xsd
========================

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>

  <xs:element name="root">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="title" type="xs:string"/>
        <xs:element name="alttitle" type="xs:string"/>
        <xs:element name="url" type="xs:string"/>
        <xs:element name="body" type="xs:string"/>
        <xs:element name="keywords">
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="Zygotes"/>
                    <xs:enumeration value="Babies"/>
                    <xs:enumeration value="Kids"/>
                    <xs:enumeration value="Teenagers"/>
                                   </xs:restriction>
            </xs:simpleType>                   </xs:element>
        <xs:element name="picture" type="xs:string"/>
        <xs:element name="questions">
          <xs:complexType>
            <xs:sequence>
<xs:element name="question" minOccurs="1" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
<xs:element name="questionBody" type="xs:string"/> <xs:element name="questionExplanation" type="xs:string"/>
                    <xs:element name="answers">
                      <xs:complexType>
                        <xs:sequence>
<xs:element name="answer" minOccurs="1" maxOccurs="unbounded">
                            <xs:complexType>
                              <xs:sequence>
<xs:element name="answerBody" type="xs:string"/> <xs:element name="correct" type="xs:boolean"/>
                              </xs:sequence>
                            </xs:complexType>
                          </xs:element>
                        </xs:sequence>
                      </xs:complexType>
                    </xs:element>


                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              </xs:sequence>
          </xs:complexType>
        </xs:element>

      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>


========================
layout.xml
========================
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="http://repository.hippocms.org/ schemas/cms-6.04/editor/layout.xsd">

  <template name="/">
    <messagewidget class="demoMessages"/>
    <validationwidget class="demoValidationMessages"/>
    <group type="columns">
      <textfield id="/root/title"/>
      <textfield id="/root/alttitle"/>
      <selectgroup id="/root/keywords"/>
      <textfield id="/root/url"/>
      <picturepreview id="/root/picture" pic-height="50"/>

<htmlfield id="/root/body" class="myDemoHtmlArea" initFunc="myDemoHtmlArea"/>
      <group type="container">
        <macro-call id="repeater-header">
          <param name="path">/root/questions/question</param>
        </macro-call>
        <display id="/root/questions/question"/>
        <group type="container">
          <macro-call id="repeater-header">
<param name="path">/root/questions/question/answers/ answer</param>
          </macro-call>
          <display id="/root/questions/question/answers/answer"/>
        </group>
    </group>
    </group>
  </template>

  <template name="/root/questions/question">
    <gridrow>
      <cell col="1" colspan="2">
        <action action="delete" ref="/root/questions/question"/>
      </cell>

    </gridrow>
<htmlfield id="/root/questions/question/questionBody" class="myDemoHtmlArea" initFunc="myDemoHtmlArea"/> <htmlfield id="/root/questions/question/questionExplanation" class="myDemoHtmlArea" initFunc="myDemoHtmlArea"/>

  </template>


  <template name="/root/questions/question/answers/answer">
    <gridrow>
      <cell col="1" colspan="2">
<action action="delete" ref="/root/questions/question/ answers/answer"/>
      </cell>

    </gridrow>
<htmlfield id="/root/questions/question/answers/answer/ answerBody" class="myDemoHtmlArea" initFunc="myDemoHtmlArea"/> <checkbox id="/root/questions/question/answers/answer/ correct"/>
  </template>

  <macro name="repeater-header">
    <grid width="100%">
      <cell row="1" col="1"> ${label} </cell>
      <cell row="1" col="1">
        <action action="add" ref="${path}"/>
      </cell>
    </grid>
  </macro>

</layout>

========================
business_logic.xml
========================
<businesslogic xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance" xsi:noNamespaceSchemaLocation="http://repository.hippocms.org/ schemas/cms-6.04/editor/businesslogic.xsd">

  <i18n>
    <field-prefix>cms.demo.fields</field-prefix>
    <help-prefix>cms.demo.help</help-prefix>
  </i18n>

  <libs>
    <!-- declare a code library
'src' is a html uri, in this case we use the default library
      -->
    <lib src="/editing/cf2/js/htmlarea.js"/>
  </libs>

  <pickers>
    <picker class="ResourcePopup2" id="asset">
<arg><![CDATA['/explorer/resource-picker/binaries/? mode=asset']]></arg>
    </picker>
  </pickers>



  <!-- for htmlarea you need to define 2 business logic rules :
1. a binding-class; a java class which converts the results of the 'htmlarea' form element
           to valid xml
       2. htmlcleaner convertor; filters out invalid HTML elements.
       -->
  <rule for="/root/body">
<binding- class>nl.hippo.cocoon.forms.binding.HTMLAreaBinding</binding-class> <convertor type="htmlcleaner" config="cocoon://editing/cf2/ HtmlCleanerConfiguration.xml"
      use="datamodel"/>
  </rule>

  <rule for="/root/title">
    <validation>
      <validator name="length" min="1" max="100"/>
    </validation>
  </rule>

  <rule for="/root/alttitle">
    <validation>
      <validator name="length" min="0" max="50"/>
    </validation>
  </rule>


  <rule for="/root/questions/question">
    <binding>
      <insert-node>
        <questionBody/>

      </insert-node>
    </binding>
  </rule>



  <rule for="/root/questions/question/answers/answer">
    <binding>
      <insert-node>
        <answerBody/>

      </insert-node>
    </binding>
  </rule>


  <rule for="/root/sections/question/questionBody">
<binding- class>nl.hippo.cocoon.forms.binding.HTMLAreaBinding</binding-class> <convertor type="htmlcleaner" config="cocoon://editing/cf2/ HtmlCleanerConfiguration.xml"
      use="datamodel"/>
  </rule>

  <rule for="/root/sections/question/answerBody">
<binding- class>nl.hippo.cocoon.forms.binding.HTMLAreaBinding</binding-class> <convertor type="htmlcleaner" config="cocoon://editing/cf2/ HtmlCleanerConfiguration.xml"
      use="datamodel"/>
  </rule>

  <rule for="/root/picture">
    <picker id="asset"/>
  </rule>



</businesslogic>

===============================

Seth Gottlieb
Content Here
P.O. Box 60062
Florence, MA 01062
http://www.contenthere.net

office: 857.488.4386

===============================

*******************************************
Pan Mass Challenge Rider:
http://www.pmc.org/egifts/giftinfo.asp?EgiftID=SG0137
*******************************************

********************************************
Hippocms-dev: Hippo CMS development public mailinglist


--
Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
[EMAIL PROTECTED] / http://www.hippo.nl
--------------------------------------------------------------
********************************************
Hippocms-dev: Hippo CMS development public mailinglist

===============================

Seth Gottlieb
Content Here
P.O. Box 60062
Florence, MA 01062
http://www.contenthere.net

office: 857.488.4386

===============================

*******************************************
Pan Mass Challenge Rider:
http://www.pmc.org/egifts/giftinfo.asp?EgiftID=SG0137
*******************************************

********************************************
Hippocms-dev: Hippo CMS development public mailinglist


--

Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
[EMAIL PROTECTED] / http://www.hippo.nl
--------------------------------------------------------------
********************************************
Hippocms-dev: Hippo CMS development public mailinglist

===============================

Seth Gottlieb
Content Here
P.O. Box 60062
Florence, MA 01062
http://www.contenthere.net

office: 857.488.4386

===============================

*******************************************
Pan Mass Challenge Rider:
http://www.pmc.org/egifts/giftinfo.asp?EgiftID=SG0137
*******************************************

********************************************
Hippocms-dev: Hippo CMS development public mailinglist

Reply via email to