Hi there,

I have a problem with CForms selection lists. What I am trying to do is the following:

The user selects a report name in a selection-list where the names are shown in human-readable form (e.g. "Money Statement"). I want to trigger a pdf processing pipeline, but my stylesheets have short names, e.g. the one for "Money Statement" is called "MT950MS.xsl". So this is what I want to include in my call to sendPage.

The problem is: This translation doesn't work, what is passed back by sendPage is always the string the user selected. In my flow script (see below) I translate the long name using a function
"chooseMessageType":
        var mt = chooseMessageType(model.reportType);
Then I define the hash used in my call to sendPage:
        var bizdata = { "reportType" : mt, "account" : model.account, "reportDate" : model.reportDate }
Finally, the call to sendPage:
          cocoon.sendPage("create", bizdata);

What have I done wrong?

I am using Cocoon-2.1.7 with Jetty on Windows 2000.

The relevant portions of my Cocoon application are as follows:

----------------------------------
Form Definition:

....
  <fd:widgets>
    <fd:field id="reportType" required="true">
      <fd:label>Report type:</fd:label>
      <fd:datatype base="string"/>
      <fd:selection-list id="reportType" required="true">
        <fd:item value="Monthly Interest Scales"/>
        <fd:item value="Money Statement"/>
...
      </fd:selection-list>
    </fd:field>
....
-----------------------------------
Flow:

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

function chooseMessageType (longName) {
  var ret="";
  switch (longName) {
    case "Monthly Interest Scales":
      ret="MT935";
      break;
    case "Money Statement":
      ret="MT950MS";
      break;
....
  }
  return ret;
}

function reportSelection() {
  var url = "">
  var form = new Form(url);
  form.showForm("reportSelection");
  var model = form.getModel();
  var mt = chooseMessageType(model.reportType);
  var bizdata = { "reportType" : mt, "account" : model.account, "reportDate" : model.reportDate }
  cocoon.sendPage("create", bizdata);
}
-----------------------------------
Sitemap:

      <map:match pattern="create">
        <map:generate src="">
        <map:transform src="">
        <map:serialize type="fo2pdf"/>
      </map:match>


Kind Regards
José Diaz Seng

Reply via email to