cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hepabolu <hepab...@gmail.com>
Subject Bugs in ajaxified cform?
Date Thu, 24 Nov 2005 15:04:52 GMT
Guys,

for quite some time now I'm trying to get a form up and running the way 
I want it to. I'm using 2.1.9-dev and it seems I've stumbled into some bugs:

1: binding in union doesn't work.
2. (maybe not ajax-related) repeater omits last (10th) item.

1. binding in union

I have a union with two cases, one with a dummy field (i.e. not used), 
one with 3 fields (an integer, a boolean and a string). I fill a JS-bean 
  with preset values for those three fields.
The form starts with the first case as default (set in the JS-bean, 
works). When I switch to the other case, the preset values don't show up.

model:

       <fd:field id="exhibition" required="true">
          <fd:label>Exhibition</fd:label>
          <fd:datatype base="string"/>
          <fd:initial-value>FALSE</fd:initial-value>
          <fd:selection-list>
             <fd:item value="TRUE"><fd:label>Yes</fd:label></fd:item>
             <fd:item value="FALSE"><fd:label>No</fd:label></fd:item>
          </fd:selection-list>
       </fd:field>
       <fd:union id="doexhibition" case="exhibition">
          <fd:widgets>
             <fd:group id="TRUE">
                <fd:widgets>
                   <fd:field id="exhibitionsize">
                      <fd:label>
                         <i18n:text>exhibitionsize</i18n:text>
                      </fd:label>
                      <fd:datatype base="integer"/>
                   </fd:field>
                   <fd:booleanfield id="exhibitionwall">
                      <fd:label>
                         <i18n:text>exhibitionwall</i18n:text>
                      </fd:label>
                   </fd:booleanfield>
                   <fd:field id="exhibitionpartner">
                      <fd:label>
                         <i18n:text>exhibitionpartner</i18n:text>
                      </fd:label>
                      <fd:datatype base="string"/>
                   </fd:field>
                </fd:widgets>
             </fd:group>
             <fd:group id="FALSE">
                <fd:widgets>
                   <fd:field id="noexhibition" state="output">
                      <fd:label/>
                      <fd:datatype base="string"/>
                      <fd:initial-value>noexhibition</fd:initial-value>
                   </fd:field>
                </fd:widgets>
             </fd:group>
          </fd:widgets>
       </fd:union>


Note: noexhibition is a dummy. I don't use it. Also, it doesn't work 
(i.e. the text doesn't show up) and if I remove it (i.e. the "FALSE" 
group has no widgets) I get errors.

template:

                   <tr>
                      <td class="label">
                         <ft:widget-label id="exhibition"/>
                      </td>
                      <td>
                         <ft:widget id="exhibition"/>
                      </td>
                   </tr>
                   <tr>
                      <td/>
                      <td>
                         <ft:union id="doexhibition">
                            <ft:case id="FALSE">
                               <ft:group id="FALSE">
                                  <span>
                                     <ft:widget id="noexhibition"/>
                                     <em>I don't want to exhibit.</em>
                                  </span>
                               </ft:group>
                            </ft:case>
                            <ft:case id="TRUE">
                               <ft:group id="TRUE">
                                  <table class="blanktable">
                                     <tr>
                                        <td class="label">
                                           <ft:widget-label 
id="exhibitionsize"/>
                                        </td>
                                        <td>
                                           <ft:widget id="exhibitionsize"/>
                                        </td>
                                     </tr>
                                     <tr>
                                        <td class="label">
                                           <ft:widget-label 
id="exhibitionwall"/>
                                        </td>
                                        <td>
                                           <ft:widget id="exhibitionwall"/>
                                        </td>
                                     </tr>
                                     <tr>
                                        <td class="label">
                                           <ft:widget-label 
id="exhibitionpartner"/>
                                        </td>
                                        <td>
                                           <ft:widget 
id="exhibitionpartner"/>
                                        </td>
                                     </tr>
                                  </table>
                               </ft:group>
                            </ft:case>
                         </ft:union>

binding:

  <fb:value id="exhibition" path="exhibition"/>
  <fb:union id="doexhibition" path=".">
   <fb:case id="TRUE" path=".">
    <fb:group id="TRUE" path=".">
     <fb:value id="exhibitionsize" path="exhibitionsize"/>
     <fb:value id="exhibitionwall" path="exhibitionwall"/>
     <fb:value id="exhibitionpartner" path="exhibitionpartner"/>
    </fb:group>
   </fb:case>
  </fb:union>

flow.js:

var dataBean = new Object();
dataBean.exhibition = "FALSE";
dataBean.exhibitionsize = new Packages.java.lang.Integer(1);
dataBean.exhibitionwall = false;
dataBean.exhibitionpartner = "John Doe";

What am I doing wrong?

2. repeater messes with last item of array

I have this same bean with 10 items that I want to display in a 
repeater. The only thing allowed in the repeater is changing the order 
of the items. Displaying the list: all is fine. Pressing submit and I 
end up with the last item empty. This happens both with an unmodified 
and a modified list.

model:

       <fd:repeater id="workshops">
          <fd:label>Workshops</fd:label>
          <fd:widgets>
             <fd:field id="workshop">
                <fd:label>Name</fd:label>
                <fd:datatype base="string"/>
             </fd:field>
             <fd:row-action id="up" command="move-up"/>

             <fd:row-action id="down" command="move-down"/>
          </fd:widgets>
       </fd:repeater>

template:

<tr>
<td class="label">
    <ft:widget-label id="workshops"/>
</td>
<td>
    <ft:repeater id="workshops">
       <table>
          <tbody>
             <tr>
                <th/>
                <th>
                   <ft:repeater-widget-label widget-id="workshop"/>
                </th>
                <th/>
             </tr>
             <ft:repeater-rows>
                <tr>
                   <td> ${repeaterLoop.index + 1} </td>
                   <td>
                      <ft:widget id="workshop"/>
                   </td>
                   <td>
                      <!-- Don't display the "move up" button on the 
first row -->
                      <jx:choose>
                         <jx:when test="${repeaterLoop.first}">
                            <img src="resources/forms/img/blank_btn.gif"/>
                         </jx:when>
                         <jx:otherwise>
                            <ft:widget id="up">
                              <fi:styling type="image"
                              src="resources/forms/img/move_up.gif"/>
                            </ft:widget>
                         </jx:otherwise>
                      </jx:choose>
                      <!-- Don't display the "move down" button on the 
first row -->
                      <jx:choose>
                         <jx:when test="${repeaterLoop.last}">
                            <img src="resources/forms/img/blank_btn.gif"/>
                         </jx:when>
                         <jx:otherwise>
                            <ft:widget id="down">
                              <fi:styling type="image"
                              src="resources/forms/img/move_down.gif"/>
                            </ft:widget>
                         </jx:otherwise>
                      </jx:choose>
                   </td>
                </tr>
             </ft:repeater-rows>
          </tbody>
       </table>
    </ft:repeater>
</td>
</tr>

binding:

  <fb:simple-repeater id="workshops" parent-path="." row-path="workshops">
    <fb:value id="workshop" path="workshop"/>
  </fb:simple-repeater>


flow.js:

    dataBean.workshops = [
     {workshop: "MAS*" },
     {workshop: "3DE"  },
     {workshop: "ORI"  },
     {workshop: "PAA*" },
     {workshop: "MAP*" },
     {workshop: "KUS"  },
     {workshop: "OSB"  },
     {workshop: "DOO"  },
     {workshop: "KAD"  },
     {workshop: "PAT"  }
     ];

resultpage:

<jx:forEach var="item" items="${dataBean.workshops}" varStatus="status" 
step="1">
    <jx:if test="${status.count &lt; 10}">&nbsp;</jx:if>
    ${status.count}: ${item.workshop}
    <br/>
</jx:forEach>

Note: all 10 items are displayed in the repeater (i.e. there are 10 
lines in the repeater and the last one shows "PAT"). The resultpage 
shows 10 lines, but the last one has no value (i.e. no "PAT").

What am I doing wrong?

Thanks.

Bye, Helma

Mime
View raw message