Warrell wrote:
Hi,

Can anyone shed a bit more light on how to user the filter parameter? The
documentation states :-

This list is filterable, and if a filter is provided, the "filter" parameter
is appended to the URL, e.g. <fd:selection-list
src="cocoon://pipeline.xml"/>  will call, given the "foo" filter value, the
URL cocoon://pipeline.xml?filter=foo.

Where do I specify the parameter value? What I would like to do is :-

In the Template form define the selection list as

        <fd:field id="sourcecode" required="true">
                <fd:label>Source Code:</fd:label>
              <fd:datatype base="string"/>
              <fd:selection-list src="cocoon:/sources" cache="request"/>
        </fd:field>

Then in the Instance form do something like :-

        <ft:widget id="sourcecode">
                <filter>${team}</filter>
        </ft:widget>

So that in the sitemap I can do :-

        <map:match pattern="sources">
                <map:generate src="teams.xml"/>
                <map:transform src="filterTeamsToSL.xsl">
                        <map:parameter name="team"
value="{request-param:filter}"/>
                </map:transform>
                <map:serialize type="xml"/>
        </map:match>

Is this how it's supposed to work? I will take another look at the Java
source but any help would be very welcome,

Regards

Warrell

Hi Warrell,

You can set the filter in the fd:on-value-changed javascript.
Using your sourcecode field you'ld need another field in which the filter is specified, for example:

<fd:field id="filter">
  <fd:label>filter</fd:label>
  <fd:datatype base="string"/>
  <fd:on-value-changed>
    <fd:javascript>
      var sourcecodeWidget = this.lookupWidget('../sourcecode');
      if (this.value != null) {
sourcecodeWidget.setSelectionList('cocoon:/sources?filter=' + this.value);
      } else {
        sourcecodeWidget.setSelectionList('cocoon:/sources');
      }
    </fd:javascript>
  </fd:on-value-changed>
</fd:field>

You can also use the following lines to enable/disable the field when there's no filter specified.

sourcecodeWidget.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.ACTIVE);
sourcecodeWidget.setState(Packages.org.apache.cocoon.forms.formmodel.WidgetState.DISABLED);

regards,

Pieter


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

Reply via email to