Fabian,
Thanks, now I'm at least able to render the suggestion-list
successfully. But the list shows a strange behaviour. Sometimes the list
is dropping down when entering data as it should but sometimes nothing
happens (depends on entered data obviously). I couldn't figure why. With
TcpMon between the list-items always looks fine on the wire but the
JavaScript console logs the same error when the list doesn't drop down:
Error: results has no properties
Source File: http://localhost:8887/daisy/resources/cocoon/dojo/dojo.js
Line: 446
Any ideas?
Thanks
Yves
[EMAIL PROTECTED] wrote:
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="[EMAIL PROTECTED]">
<input name="[EMAIL PROTECTED]" id="[EMAIL PROTECTED]: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 [EMAIL PROTECTED]
web http://www.s-und-n.de
|---------+--------------------------->
| | Yves Langisch |
| | <[EMAIL PROTECTED]|
| | 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]