cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject CForms: where and how to specify the suggestion-list?
Date Thu, 22 Sep 2005 09:44:01 GMT
Hi all,

I'm currently working on adding a "Cocoon suggest" feature to CForms 
fields based on Scriptaculous [1]. This requires to associate an URL to 
the field to fetch the suggestion list using Ajax requests when the user 
inputs something.

Question is: where and how do we specify this? Is this a concern of the 
form definition, or a particular styling of the field?

Concretely, should it be
  <fd:field id="foo">
    <fd:suggestion-list url="foo-suggest">
  <ft:widget id="foo">
    <fi:styling suggest-href="foo-suggest">

It seems more natural at first to add this to the definition, but the 
url attribute must define an externally addressable url providing markup 
suited to the particular implementation of the suggestion (in the 
current case, it's a <li> with special classes). It is therefore more 
related to the view. Also, we may consider that the simple fact that we 
want to autocomplete is a view concern.


Another solution would be for the suggestion list in the definition to 
be given using the same syntax as <fd:selection-list> and have a 
system-provided default pipeline to render the list:

  <fd:field id="foo">
    <fd:suggestion-list src="cocoon:/foo-suggestion-list"/>
    <!-- or use whatever implementation of selection list you want -->

This will automatically generate a
  <fi:styling suggest-href="_cforms-suggest-foo"/>

which will be answered to in the sitemap with something like:
  <map:match pattern="_cforms-suggest-*">
    <map:generate type="jx" 
    <map:serialize type="xml"/>

This approach still allows to specify the suggest-href only in the view 
for cases where it's considered as being a view-only concern, and it 
also allows to specify different renderings of the suggestion list by 
catching the "_cforms-suggest-xxxx" pattern before the generic 




Sylvain Wallez                        Anyware Technologies
Apache Software Foundation Member     Research & Technology Director

View raw message