cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robby Pelssers" <robby.pelss...@ciber.com>
Subject RE: Cocoon 2.2 / Cocoon forms repeater problem
Date Tue, 15 Sep 2009 10:20:15 GMT
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: users@cocoon.apache.org
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");

}

 

 

 


Mime
View raw message