I'm having a problem creating a CForm with repeaters and binding it to an XML 
document. I found Scott's email on the mailing list last year (June 22, 2004) 
with a similar error and I'm wondering if anyone else has had the error and 
found a solution.

I have based my code on the sample in cocoon, with the following files...
 - form2_model.xml
 - form2_bind_xml.xml
 - form2_template.xml

specifically I was looking at the 'contacts' widget in those files.

This is my error...
org.mozilla.javascript.EvaluatorException: 
"resource://org/apache/cocoon/forms/flow/javascript/Form.js", line 183: 
Invalid JavaScript value of type org.mozilla.javascript.UniqueTag

Below are my xml files.

Thanks
Michael Ralston

This is my form definition...
-----
<?xml version="1.0"?>
<fd:form
        xmlns:fd="http://apache.org/cocoon/forms/1.0#definition";
        xmlns:i18n="http://apache.org/cocoon/i18n/2.1";>
  <fd:widgets>

    <fd:repeater id="images">
      <fd:widgets>

        <fd:output id="id">
          <fd:datatype base="long"/>
        </fd:output>

        <fd:field id="name">
          <fd:label>Name</fd:label>
          <fd:datatype base="string"/>
        </fd:field>

        <fd:field id="source">
          <fd:label>Full Size Image</fd:label>
          <fd:datatype base="string"/>
          <fd:select-list dynamic="true" type="flow-jxpath" list-path="assets" 
value-path="value" label-path="label" required="true"/>
        </fd:field>

        <fd:field id="thumb">
          <fd:label>Small Size Image</fd:label>
          <fd:datatype base="string"/>
          <fd:select-list dynamic="true" type="flow-jxpath" list-path="assets" 
value-path="value" label-path="label" required="true"/>
        </fd:field>

        <fd:booleanfield id="select">
          <fd:label>Select</fd:label>
        </fd:booleanfield>

      </fd:widgets>
    </fd:repeater>

    <fd:repeater-action id="addimage" command="add-row" repeater="images">
      <fd:label>Add Image</fd:label>
    </fd:repeater-action>

    <fd:repeater-action id="removeimages" command="delete-rows" 
repeater="images" select="select">
      <fd:label>Remove selected Images</fd:label>
    </fd:repeater-action>

    <fd:submit id="save" action-command="submit" validate="true">
      <fd:label>Save</fd:label>
      <fd:hint>Save this Gallery</fd:hint>
    </fd:submit>

  </fd:widgets>
</fd:form>
-----

This is my form binding...
-----
<?xml version="1.0"?>
<fb:context xmlns:fb="http://apache.org/cocoon/forms/1.0#binding"; path="/" >
  <fb:repeater id="items" parent-path="gallery" row-path="image">
    <fb:on-bind>
      <fb:javascript id="id" path="@id" direction="save">
        <fb:save-form>
          var appValue = jxpathPointer.getValue();
          if (appValue == '') {
            var precSiblId = 
jxpathContext.getValue("../preceding-sibling::image/@id");
            var newId = Number(precSiblId) + 1;
            jxpathPointer.setValue(newId.toFixed(0));
          }
        </fb:save:form>
      </fb:javascript>
      <fb:value id="name" path="@name"/>
      <fb:value id="source" path="@source"/>
      <fb:value id="thumb" path="@thumb"/>
    </fb:on-bind>
    <fb:on-delete-row>
      <fb:delete-node/>
    </fb:on-delete-row>
    <fb:on-insert-row>
      <fb:insert-node>
        <image id=""
               name=""
               source="http://servername/directory/image3.jpg";
               thumb="http://servername/directory/thumb3.jpg"; />
      </fd:insert-node>
    </fb:on-insert-row>
  </fb:repeater>
</fb:context>
-----

This is my form template...
-----
<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template";
      xmlns:fi="http://apache.org/cocoon/forms/1.0#instance";>
  <title>Editing Promotional Item</title>
  <content>
    <ft:form-template action="#{$continuation/id}.continue" method="POST">
      <input type="hidden" name="lenya.usecase" value="galleryeditor"/>

      <ft:widget-label id="images"/><br/>
      <ft:repeater-size id="images"/>
      <table border="1">
        <tr>
          <th><ft:repeater-widget-label id="images" widget-id="name"/></th>
          <th><ft:repeater-widget-label id="images" widget-id="source"/></th>
          <th><ft:repeater-widget-label id="images" widget-id="thumb"/></th>
          <th><ft:repeater-widget-label id="images" widget-id="select"/></th>
        </tr>

        <ft:repeater-widget id="images">
          <tr>
            <td><ft:widget id="name"/></td>
            <td><ft:widget id="source"/></td>
            <td><ft:widget id="thumb"/></td>
            <td><ft:widget id="select"/></td>
          </tr>
        </ft:repeater-widget>

        <tr>
          <td colspan="4" align="right">
            <ft:widget id="addimage"/>
            <ft:widget id="removeimages"/>
          </td>
        </tr>
      </table>

      <ft:widget id="save"/>
    </ft:form-template>
  </content>
</page>
-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to