cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jose.Diaz.S...@fimat.com
Subject CForms Selection-list: cannot replace user-selected item
Date Mon, 05 Sep 2005 11:55:07 GMT
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 = "forms/selectReport.xml";
  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="context://CreationOnlineViaCocoon/xml/{request-param:reportType}XML_{request-param:account}_{request-param:reportDate}.xml"/>
        <map:transform 
src="context://CreationOnlineViaCocoon/xsl/{request-param:reportType}.xsl"/>
        <map:serialize type="fo2pdf"/>
      </map:match>


Kind Regards
José Diaz Seng
Mime
View raw message