Showing what you did wrong in this case could help others finding out that they made the same mistake.

As a side note: I've been reading your blog, so if you have more interesting stuff do write about it ;-)

Cheers,

Jeroen

Robby Pelssers wrote:
Not sure what knowledge you're talking about ;-)  It was my own silly
mistake in the snippet below.  BUT once this searcher is working I'll
might write some hands on Cocoon forms material on my blog... I used
cocoonforms intensively in the past so I could blog a more advanced
showcase.

              <div class="preview">
                <ft:form-template
action="#{$cocoon/continuation/id}.continue" method="POST"> <ft:widget id="properties"> <!-- should become
<ft:repeater id="properties"/>   -->
                    <table>
                      <tbody>
                        <ft:repeater-rows>
                          <tr>
                            <td>
                              <ft:widget id="propertyName"/>
                            </td>
                          </tr>
</ft:repeater-rows> </tbody>
                    </table>
                  </ft:widget> <!-- should become <ft:repeater/>   -->
</ft:form-template> </div>

-----Original Message-----
From: Jeroen Reijn [mailto:[email protected]] Sent: Tuesday, September 15, 2009 1:38 PM
To: [email protected]
Subject: Re: Cocoon 2.2 / Cocoon forms repeater problem

Robby,

thanks for sharing this knowledge! It's much appreciated!

Regards,

Jeroen

Robby Pelssers wrote:
Solved ;-)

<ft:widget id=/"properties"/> should become <ft:repeater
id=/"properties"/>
Cheers,

Robby

*From:* Robby Pelssers [mailto:[email protected]]
*Sent:* Tuesday, September 15, 2009 1:04 PM
*To:* [email protected]
*Subject:* RE: Cocoon 2.2 / Cocoon forms repeater problem

I just took a look at "servlet:forms:/resource/internal/xsl/forms-field-styling.xsl" and following snippets would explain my problem. Is it correct to assume <ft:repeater> get's replaced by <fi:repeater> by the jxmacroshelper and finally the forms-field-styling.xsl does it's job? Then where do
I
get the opportunity to overrule the layout/representation of my
repeater??
Robby

<!--+

      | fi:repeater

      +-->

<xsl:template match="fi:repeater">

  <input type="hidden" name="{...@id}.size" value="{...@size}"/>

  <input type="hidden" name="{...@id}.page" value="{...@page}"/>

  <table id="{...@id}" border="1">

    <xsl:apply-templates select="." mode="css"/>

    <tr>

      <xsl:for-each select="fi:headings/fi:heading">

        <th>

          <xsl:value-of select="."/>

        </th>

      </xsl:for-each>

    </tr>

    <xsl:apply-templates select="fi:repeater-row"/>

  </table>

</xsl:template>

<!--+

      | fi:repeater-row

      +-->

<xsl:template match="fi:repeater-row">

  <tr>

    <xsl:for-each select="*">

      <td>

        <xsl:apply-templates select="."/>

      </td>

    </xsl:for-each>

  </tr>

</xsl:template>

*From:* Robby Pelssers [mailto:[email protected]]
*Sent:* Tuesday, September 15, 2009 12:20 PM
*To:* [email protected]
*Subject:* RE: Cocoon 2.2 / Cocoon forms repeater problem

Oh...

The generated html code looks like below.  I still see <fi:widgets>
in
the output... Is that correct?   Or am I just missing some
transformation
step?

Robby

<form state="active" locale="en-US" action="403253117e5a6e366c70082b4f680a1002327f03.continue"
method="POST"
id="N10073" dojoType="forms:SimpleForm">

            <input value="15" name="properties.size" type="hidden"/>

            <input value="" name="properties.page" type="hidden"/>

            <table border="1" id="properties" class="forms repeater
active">
                        <tr>

                                    <th/>

                                    <th/>

                                    <th/>

                        </tr>

                        <tr>

                                    <td>

                                                <fi:widgets>

<span id="properties.0.propertyName" class="forms field output">iec</span>

<span id="properties.0.datatype">



<select name="properties.0.datatype" id="properties.0.datatype:input" title="" class="forms field active">



<option value="string" selected="selected">string</option>



<option value="integer">integer</option>



<option value="long">long</option>



<option value="double">double</option>



<option value="date">date</option>



<option value="char">char</option>



<option value="decimal">decimal</option>



</select>

                                                            </span>

<span id="properties.0.operator">



<select name="properties.0.operator" id="properties.0.operator:input" title="" class="forms field active">



<option value="EQUALS">=</option>



<option value="IS_NULL">is null</option>



<option value="IS_EMPTY">is empty</option>



<option value="CONTAINS">contains</option>



</select>

                                                            </span>

                                                </fi:widgets>

                                    </td>

                        </tr>

                        <tr>

                                    <td>

                                                <fi:widgets>

<span id="properties.1.propertyName" class="forms field output">packageOutlineVersionCode</span>

<span id="properties.1.datatype">



<select name="properties.1.datatype" id="properties.1.datatype:input" title="" class="forms field active">



<option value="string" selected="selected">string</option>



<option value="integer">integer</option>



<option value="long">long</option>



<option value="double">double</option>



<option value="date">date</option>



<option value="char">char</option>



<option value="decimal">decimal</option>



</select>

                                                            </span>

<span id="properties.1.operator">



<select name="properties.1.operator" id="properties.1.operator:input" title="" class="forms field active">



<option value="EQUALS">=</option>



<option value="IS_NULL">is null</option>



<option value="IS_EMPTY">is empty</option>



<option value="CONTAINS">contains</option>



</select>

                                                            </span>

                                                </fi:widgets>

                                    </td>

                        </tr>

                        .... More table rows

            </table>

</form>

*From:* Robby Pelssers
*Sent:* Tuesday, September 15, 2009 12:05 PM
*To:* [email protected]
*Cc:* Robby Pelssers
*Subject:* Cocoon 2.2 / Cocoon forms repeater problem

Hi all,

I'm trying to build a form using cocoon forms and the snippets below show my setup. What I basically do in flowscript is creating the form

from the formdefinition.xml and I pass this form on to the ObjectSearcher java class which populates the widgets with the correct

values.

      *this*.form = *new* Form("cocoon://formdefinition");

*this*.objectSearcher = *new* ObjectSearcher(*this*.form.form, *this*.packageSelector.getProperties());

However, when I open the page containing the form, it looks like if
the
form DOES NOT TAKE INTO ACCOUNT the way my template defines it. The output I get is attached (searchform.gif). I would expect in this
case
to ONLY see the propertyName widget in the output.
Anybody an idea if I forgot something in the configuration?

I added "/resource/internal/xslt/forms-samples-styling.xsl" and In my servlet config I also added two entries:

<entry key=/"ajax"/ value-ref=/"org.apache.cocoon.ajax.impl.servlet"//>

<entry key=/"forms"/ value-ref=/"org.apache.cocoon.forms.impl.servlet"//>
Thx in advance,

Robby Pelssers

Formdefinition.xml

<?xml version=/"1.0"/ encoding=/"UTF-8"/?>

<fd:form xmlns:fd=/"http://apache.org/cocoon/forms/1.0#definition"/>

  <fd:widgets>

    <fd:repeater id=/"properties"/>

      <fd:widgets>

        <fd:field id=/"propertyName"/ state=/"output"/>

<fd:datatype base=/"string"//>
        </fd:field>

        <fd:field id=/"datatype"/>

            <fd:datatype base=/"string"//>

            <fd:selection-list>

              <fd:item value=/"string"//>

              <fd:item value=/"integer"//>

<fd:item value=/"long"//> <fd:item value=/"double"//>
              <fd:item value=/"date"//>

<fd:item value=/"char"//> <fd:item value=/"decimal"//>
          </fd:selection-list>

        </fd:field>

        <fd:field id=/"operator"/>

<fd:datatype base=/"string"//> </fd:field>
      </fd:widgets>

    </fd:repeater>

  </fd:widgets>

</fd:form>

Searchform.jx:

              <div class=/"preview"/>

<ft:form-template action=/"#{$cocoon/continuation/id}.continue"/ method=/"POST"/>

                  <ft:widget id=/"properties"/>

                    <table>

                      <tbody>

                        <ft:repeater-rows>

                          <tr>

                            <td>

                              <ft:widget id=/"propertyName"//>

                            </td>

                          </tr>

</ft:repeater-rows>
                      </tbody>

                    </table>

                  </ft:widget>

                </ft:form-template>

              </div>

Sitemap.xmap:

       <map:match pattern=/"formdefinition"/>

<map:generate src=/"page/templates/formdefinition.xml"//>
        <map:serialize type=/"xml"/ />

       </map:match>

      <map:match pattern=/"search"/>

        <map:call function=/"search"/ />

</map:match>
       <map:match pattern=/"searchform.jx"/>

        <map:generate src=/"page/templates/searchform.jx"/ type=/"jx"/
/>
<map:transform src=/"resource/internal/xslt/forms-samples-styling.xsl"/>

<map:parameter name=/"dojo-resources"/ value=/"{servlet:ajax:/resource/external/dojo}"//>

<map:parameter name=/"forms-resources"/ value=/"{servlet:forms:/resource/external/forms}"//>

</map:transform>
        <map:serialize type=/"xhtml"/ />

       </map:match>

Flowscript:


importClass(Packages.com.nxp.spider2.parametricsearch.cforms.ObjectSearc
her);
*function* search() {

      *var* searcher = *new* Searcher();

}

*function* Searcher() {

    *this*.initialize();

}

Searcher.prototype.initialize = *function*() {

cocoon.load("servlet:forms:/resource/internal/flow/javascript/Form.js");
      *this*.packageSelector = cocoon.getComponent("packageSelector");

      *this*.form = *new* Form("cocoon://formdefinition");

*this*.objectSearcher = *new* ObjectSearcher(*this*.form.form, *this*.packageSelector.getProperties());

      *this*.showForm();

}

Searcher.prototype.showForm = *function*() {

      *this*.form.showForm("searchform.jx");

}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to