I shouldn't be allowed on computers, here's a properly formed email....I
hope.

Sorry, the formatting was messed up on the original question.

I'm having difficulty using Flowscript with CForms.� I've modified the
cforms with flowscript sample and cannot get it to work.� In the forms
blocks samples, I'm attempting to add repeater widgets to the tabs using
flowscript.� I'm trying to add a contact list to each tab.� I've modified
the form definition to include the 2 extra examples of the contact list.
There are 2 problems that I'm having, and cannot find documentation on the
mailing lists or wiki.�1.� Extra text is displaying between the <body> tag
and <h2> tag.� The
text is an unformatted plain text representation of all my labels from the
form. I have not modified the stylesheets in any manner, but that appear to
be where the problem lies.


2.� I receive this error when I attempt to add/remove a row: No function
nor continuation given in <map:call function>...� I've cut down on some of
the validation in the definition and template files, but I can't see where
I've cut out anything pertinent to continuations.





Specifically, I don't understand the section of the sitemap where it talks
about starting a flowscript scenario. � How do I access the continuation?
I see that it's part of the Flow Object Model, but I'm unsure how it gets
created.�Any help would be greatly appreciated.� Sorry this email is so
long.� I've
included my definition file, template file, jscript file and relevant
sitemap portions.

************************Sitemap.xmap***********************************
<!--Edit Supervisors-->
    <map:pipeline>
      <map:match pattern="admin/sups/edit">
        <map:call function="handleForm">
          <map:parameter name="function" value="editsup"/>
          <map:parameter name="form-definition"
value="content/forms/definitions/defn_supervisor.xml"/>
        </map:call>
      </map:match>

     <!-- Start a flowscript scenario -->
     <map:match pattern="*/**do-*.flow">
       <map:call function="do_{1}"/>
     </map:match>

     <!-- Continue a scenario. The continuation id is passed in the URL
          (typically used for GET requests) -->
     <map:match pattern="*/**.continue">
       <map:call continuation="{1}"/>
     </map:match>

     <!-- Continue a scenario. The continuation id is passed as a request
          parameter (typically used for POST request) -->
     <map:match pattern="*/**.continue">
       <map:call continuation="{request-param:continuation-id}"/>
     </map:match>

     <map:match pattern="*-display-pipeline.jx">
       <map:generate type="jx" src="content/forms/templates/tmpt_{1}.xml"
label="content1"/>
       <map:call resource="simple-page2html">
         <map:parameter name="file"
value="content/forms/templates/tmpt_{1}.xml"/>
       </map:call>
       <map:transform src="style/xslt/forms-samples-styling.xsl"/>
       <map:serialize/>
     </map:match>
    </map:pipeline>

********************defn_supervisor.xml***********************
<?xml version="1.0" encoding="utf-8" ?>

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

  <fd:widgets>
    <fd:field id="tab-state">
      <fd:datatype base="string"/>
      <fd:on-value-changed>
        <javascript>
          java.lang.System.err.println("You're getting there!");
        </javascript>
      </fd:on-value-changed>
    </fd:field>
    <fd:repeater id="salessups">
      <fd:validation>
        <!-- This demonstrates validating a repeater: we check here if all
contacts are distinct.
           A repeater cannot itself display a validation error, and
therefore sets a validation
           error on a field in the offenting row. -->
        <fd:javascript>
          var list = new java.util.ArrayList();
          var success = true;
          // Iterate on all rows
          for (var i = 0; i &lt; widget.size; i++) {
            // Get the row
            var row = widget.getRow(i);
            // Compute a key combining the first and last name
            var key = row.lookupWidget("SupID").value + "/" +
row.lookupWidget("name").value;
            if (list.contains(key)) {
              // already in the list
              row.lookupWidget("name").setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError("Duplicate
supervisor name", false));
              success = false;
              break; // no need to continue
            }
            // Add the current row's key to the list
            list.add(key);
          }

          // Must return true/false
          return success;

        </fd:javascript>
      </fd:validation>
      <fd:widgets>
        <fd:field id="SupID">
          <fd:label>ID</fd:label>
          <fd:datatype base="string"/>
        </fd:field>
        <fd:field id="name">
          <fd:label>Name</fd:label>
          <fd:datatype base="string"/>
        </fd:field>
        <fd:booleanfield id="select">
          <fd:label>Select</fd:label>
        </fd:booleanfield>
      </fd:widgets>
    </fd:repeater>

    <fd:repeater-action id="addsupsales" command="add-row"
repeater="salessups">
      <fd:label>Add supervisor</fd:label>
    </fd:repeater-action>

    <fd:repeater-action id="removesupervisorsales" command="delete-rows"
repeater="salessups" select="select">
      <fd:label>Remove selected supervisors</fd:label>
    </fd:repeater-action>

    <fd:repeater id="hlasups">
      <fd:validation>
        <!-- This demonstrates validating a repeater: we check here if all
contacts are distinct.
           A repeater cannot itself display a validation error, and
therefore sets a validation
           error on a field in the offenting row. -->
        <fd:javascript>
          var list = new java.util.ArrayList();
          var success = true;
          // Iterate on all rows
          for (var i = 0; i &lt; widget.size; i++) {
            // Get the row
            var row = widget.getRow(i);
            // Compute a key combining the first and last name
            var key = row.lookupWidget("firstname").value + "/" +
row.lookupWidget("lastname").value;
            if (list.contains(key)) {
              // already in the list
              row.lookupWidget("firstname").setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError("Duplicate
contact name", false));
              success = false;
              break; // no need to continue
            }
            // Add the current row's key to the list
            list.add(key);
          }

          // Must return true/false
          return success;

        </fd:javascript>
      </fd:validation>
      <fd:widgets>
        <fd:field id="SupID">
          <fd:label>ID</fd:label>
          <fd:datatype base="string"/>
        </fd:field>
        <fd:field id="name">
          <fd:label>Name</fd:label>
          <fd:datatype base="string"/>
        </fd:field>
        <fd:booleanfield id="select">
          <fd:label>Select</fd:label>
        </fd:booleanfield>
      </fd:widgets>
    </fd:repeater>

    <fd:repeater-action id="addsuphla" command="add-row"
repeater="hlasups">
      <fd:label>Add supervisor</fd:label>
    </fd:repeater-action>

    <fd:repeater-action id="removesupervisorhla" command="delete-rows"
repeater="hlasups" select="select">
      <fd:label>Remove selected supervisors</fd:label>
    </fd:repeater-action>

<fd:repeater id="closersups">
      <fd:validation>
        <!-- This demonstrates validating a repeater: we check here if all
contacts are distinct.
           A repeater cannot itself display a validation error, and
therefore sets a validation
           error on a field in the offenting row. -->
        <fd:javascript>
          var list = new java.util.ArrayList();
          var success = true;
          // Iterate on all rows
          for (var i = 0; i &lt; widget.size; i++) {
            // Get the row
            var row = widget.getRow(i);
            // Compute a key combining the first and last name
            var key = row.lookupWidget("firstname").value + "/" +
row.lookupWidget("lastname").value;
            if (list.contains(key)) {
              // already in the list
              row.lookupWidget("firstname").setValidationError(new
Packages.org.apache.cocoon.forms.validation.ValidationError("Duplicate
contact name", false));
              success = false;
              break; // no need to continue
            }
            // Add the current row's key to the list
            list.add(key);
          }

          // Must return true/false
          return success;

        </fd:javascript>
      </fd:validation>
      <fd:widgets>
        <fd:field id="SupID">
          <fd:label>ID</fd:label>
          <fd:datatype base="string"/>
        </fd:field>
        <fd:field id="name">
          <fd:label>Name</fd:label>
          <fd:datatype base="string"/>
        </fd:field>
        <fd:booleanfield id="select">
          <fd:label>Select</fd:label>
        </fd:booleanfield>
      </fd:widgets>
    </fd:repeater>


    <fd:repeater-action id="addsupcloser" command="add-row"
repeater="closersups">
      <fd:label>Add supervisor</fd:label>
    </fd:repeater-action>

    <fd:repeater-action id="removesupervisorcloser" command="delete-rows"
repeater="closersups" select="select">
      <fd:label>Remove selected supervisors</fd:label>
    </fd:repeater-action>
  </fd:widgets>

</fd:form>

******************temp_supervisor.xml*********************************
<?xml version="1.0" encoding="utf-8" ?>

<page xmlns:ft="http://apache.org/cocoon/forms/1.0#template";
      xmlns:fi="http://apache.org/cocoon/forms/1.0#instance";
      xmlns:jx="http://apache.org/cocoon/templates/jx/1.0";>

  <!-- Import the macros that define CForms template elements -->
  <jx:import
uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>

  <title>Supervisors Administration Form</title>
  <content>
    <!--<ft:form-template action="editsups" method="POST">-->
    <ft:form-template action="#{$cocoon/continuation/id}.continue"
method="POST">
      <div style="width: 90%; margin: 10px 50px 50px 50px;">

      <!-- grouping supervisor lists, one for each team -->
        <fi:group>

          <fi:styling type="choice"/>
          <fi:label>Select a team: </fi:label>
          <fi:state>
            <ft:widget id="tab-state"/>
          </fi:state>

          <fi:items>
            <fi:group name="salessups">
              <fi:label>Sales</fi:label>
              <fi:styling layout="columns"/>
              <fi:items>
                <ft:widget-label id="salessups"/><br/>
                  <ft:repeater-size id="salessups"/>
                    <table border="1">
                      <tr>
                        <th><ft:repeater-widget-label id="salessups"
widget-id="SupID"/></th>
                        <th><ft:repeater-widget-label id="salessups"
widget-id="name"/></th>
                        <th><ft:repeater-widget-label id="salessups"
widget-id="select"/></th>
                      </tr>
                      <jx:choose>
                        <jx:when
test="${widget.getChild('salessups').getSize() == 0}">
                         <tr><td colspan="6" align="center"><em>There are
no Sales supervisors to display</em></td></tr>
                        </jx:when>
                        <jx:otherwise>
                        <!-- The contents of the repeater-widget element is
a template that will
                               be applied to each row in the repeater. -->
                          <ft:repeater-widget id="salessups">
                            <tr>
                              <td><ft:widget id="SupID"/></td>
                              <td><ft:widget id="name"/></td>
                              <td><ft:widget id="select"/></td>
                             </tr>
                          </ft:repeater-widget>
                        </jx:otherwise>
                      </jx:choose>
                      <tr>
                        <td colspan="6">
                          <ft:widget id="addsupsales"/>
                          <jx:if
test="${widget.getChild('salessups').getSize() > 0}">
                            <ft:widget id="removesupervisorsales"/>
                            <br/>
                          </jx:if>
                       </td>
                      </tr>
                    </table>
                    <input type="submit"/>
                </fi:items>
            </fi:group>
          </fi:items>

<fi:items>
            <fi:group name="hlasups">
              <fi:label>HLAs</fi:label>
              <fi:styling layout="columns"/>
              <fi:items>
                <ft:widget-label id="hlasups"/><br/>
                  <ft:repeater-size id="hlasups"/>
                    <table border="1">
                      <tr>
                        <th><ft:repeater-widget-label id="hlasups"
widget-id="SupID"/></th>
                        <th><ft:repeater-widget-label id="hlasups"
widget-id="name"/></th>
                        <th><ft:repeater-widget-label id="hlasups"
widget-id="select"/></th>
                      </tr>
                      <jx:choose>
                        <jx:when
test="${widget.getChild('hlasups').getSize() == 0}">
                         <tr><td colspan="6" align="center"><em>There are
no HLA supervisors to display</em></td></tr>
                        </jx:when>
                        <jx:otherwise>
                        <!-- The contents of the repeater-widget element is
a template that will
                               be applied to each row in the repeater. -->
                          <ft:repeater-widget id="hlasups">
                            <tr>
                              <td><ft:widget id="SupID"/></td>
                              <td><ft:widget id="name"/></td>
                              <td><ft:widget id="select"/></td>
                             </tr>
                          </ft:repeater-widget>
                        </jx:otherwise>
                      </jx:choose>
                      <tr>
                        <td colspan="6">
                          <ft:widget id="addsuphla"/>
                          <jx:if
test="${widget.getChild('hlasups').getSize() > 0}">
                            <ft:widget id="removesupervisorhla"/>
                            <br/>
                          </jx:if>
                       </td>
                      </tr>
                    </table>
                    <input type="submit"/>
                </fi:items>
            </fi:group>
          </fi:items>

<fi:items>
            <fi:group name="closersups">
              <fi:label>Closers</fi:label>
              <fi:styling layout="columns"/>
              <fi:items>
                <ft:widget-label id="closersups"/><br/>
                  <ft:repeater-size id="closersups"/>
                    <table border="1">
                      <tr>
                        <th><ft:repeater-widget-label id="closersups"
widget-id="SupID"/></th>
                        <th><ft:repeater-widget-label id="closersups"
widget-id="name"/></th>
                        <th><ft:repeater-widget-label id="closersups"
widget-id="select"/></th>
                      </tr>
                      <jx:choose>
                        <jx:when
test="${widget.getChild('closersups').getSize() == 0}">
                         <tr><td colspan="6" align="center"><em>There are
no Closer supervisors to display</em></td></tr>
                        </jx:when>
                        <jx:otherwise>
                        <!-- The contents of the repeater-widget element is
a template that will
                               be applied to each row in the repeater. -->
                          <ft:repeater-widget id="closersups">
                            <tr>
                              <td><ft:widget id="SupID"/></td>
                              <td><ft:widget id="name"/></td>
                              <td><ft:widget id="select"/></td>
                             </tr>
                          </ft:repeater-widget>
                        </jx:otherwise>
                      </jx:choose>
                      <tr>
                        <td colspan="6">
                          <ft:widget id="addsupcloser"/>
                          <jx:if
test="${widget.getChild('closersups').getSize() > 0}">
                            <ft:widget id="removesupervisorcloser"/>
                            <br/>
                          </jx:if>
                       </td>
                      </tr>
                    </table>
                    <input type="submit"/>
                </fi:items>
            </fi:group>
          </fi:items>


        </fi:group>

      </div>
    </ft:form-template>
  </content>
</page>

************forms_edit_sups.js*************

cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");

function editsup(form) {
    var model = form.getModel();

    model.salessups[0].name = "Jules";
    model.salessups[1].name =  "Lucien";
    model.salessups[2].name = "Chris";

    form.showForm("editsup-display-pipeline.jx");
    print("submitId = " + form.submitId);

    // also store the form as a request attribute as the XSP isn't
flow-aware
    cocoon.request.setAttribute("editsup", form.getWidget());
    cocoon.sendPage("editsup-success-pipeline.xsp");
}


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

Reply via email to