cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@s-und-n.de
Subject Antwort: Troubles with Ajax (fd:suggestion-list)
Date Wed, 23 Aug 2006 08:31:57 GMT
Hi Yves,
yes, the entry in the sitemap is needed.

<map:match pattern="_cocoon/forms/suggest">
<map:generate type="suggestion-list"/> //a new generator has to be defined
at the sitemap components (see below)
<map:transform type="i18n"/>
<map:transform
src="resource://org/apache/cocoon/forms/resources/selection-list2json.xsl"/>
 //comes from the cocoon-forms-block.jar
<map:serialize type="text"/>
</map:match>

Definition of the generator:
<map:generators default="file">
      <map:generator name="suggestion-list"
src="org.apache.cocoon.forms.generation.SuggestionListGenerator"/>
</map:generators>

At the "forms-advanced-field-styling.xls" you need these lines of code:
<xsl:template match="fi:field[fi:styling/@type='suggest']">
    <span id="{@id}">
      <input name="{@id}" id="{@id}:input" value="{fi:value}" dojoType=
"CFormsSuggest">
        <xsl:if test="fi:suggestion">
          <xsl:attribute name="suggestion"><xsl:value-of select=
"fi:suggestion"/></xsl:attribute>
        </xsl:if>
      </input>
      <xsl:apply-templates select="." mode="common"/>
    </span>
  </xsl:template>

And now you define your suggestion-list in the forms-template like this:
<ft:widget id="path" type="suggest"/>

You also need this in your form-template:
<jx:import
uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
and within the forms - tag:
<ft:continuation-id/>

Hope that will help.
Freundliche Grüße / With kind regards
Fabian Hagen

S&N AG
Klingenderstr. 5
D 33100 Paderborn

voice  +49 5251/1581- 0
fax    +49 5251/1581-71
eMail  fhagen@s-und-n.de
web    http://www.s-und-n.de


|---------+--------------------------->
|         |           Yves Langisch   |
|         |           <yves@langisch.c|
|         |           h>              |
|         |                           |
|         |           23.08.2006 09:46|
|         |           Bitte antworten |
|         |           an users        |
|         |                           |
|---------+--------------------------->
  >-------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                      
                                        |
  |        An:      users@cocoon.apache.org                                              
                                        |
  |        Kopie:                                                                        
                                        |
  |        Thema:   Troubles with Ajax (fd:suggestion-list)                              
                                        |
  >-------------------------------------------------------------------------------------------------------------------------------|




Hi,

I try to get a simple Ajax sample running but I have some troubles.

My sample consists of a fd:suggestion-list as follows:

        <fd:field id="path">
            <fd:datatype base="string"/>
            <fd:suggestion-list>
                <fd:item value="aaa"/>
                <fd:item value="abb"/>
                <fd:item value="abc"/>
                <fd:item value="acc">
                    <fd:label>
                        The last one
                    </fd:label>
                </fd:item>
            </fd:suggestion-list>
        </fd:field>

I also followed the notes about Ajax on the Cocoon site:
http://cocoon.apache.org/2.1/userdocs/ajax.html

The selection list I'd like to see on my form is displayed as a normal
textfield without any interactivity. In the Coccoon samples I saw that
there is a matching rule for the asynchronous Ajax request in the
sitemap:

<map:match pattern="_cocoon/forms/suggest">
<map:generate type="suggestion-list"/>
<map:transform type="i18n"/>
<map:transform
src="resource://org/apache/cocoon/forms/resources/selection-list2json.xsl"/>

<map:serialize type="text"/>
</map:match>

Do I need this too for my static list? And where does this
'_cocoon/forms/suggest' comes from? Currently I just have a match rule
defined for the POST action of my form.

Any help is greatly appreciated!

Thanks
Yves


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message