cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
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">
  </fd:field>
or
  <ft:widget id="foo">
    <fi:styling suggest-href="foo-suggest">
  </ft:widget>

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.

Hmm...

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 -->
  </fd:field>

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" 
src="resource://org/apache/cocoon/forms/system/generate-suggest-list.xml"/>
    <map:transform 
src="resource://org/apache/cocoon/forms/system/list2html.xsl"/>
    <map:serialize type="xml"/>
  </map:match>

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 
"_cforms-suggest-*".

WDYT?

Sylvain

[1] http://script.aculo.us/

-- 
Sylvain Wallez                        Anyware Technologies
http://people.apache.org/~sylvain     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Mime
View raw message