cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Johnston <coc...@lojjic.net>
Subject Re: AW: AJAX enabling custom widget
Date Tue, 25 Jul 2006 01:12:03 GMT
Christofer Dutz wrote:
> Hi,
> 
> I added the following code underneath the radio-styled selection-lists in
> forms-field-styling.xsl:
> 
>   <!--+
>     | fi:field with a selection list and @type 'tabs'
>     +-->
>   <xsl:template
> match="fi:field[fi:selection-list][fi:styling/@list-type='tabs']"
> priority="2">
>     <xsl:variable name="value" select="fi:value"/>
>     <input type="hidden" name="{@id}" value="{fi:value}"/>
>     <xsl:for-each select="fi:selection-list/fi:item">
>       <xsl:choose>
>         <xsl:when test="@value = $value">
>           <tab selected="true"><xsl:value-of select="fi:label"/></tab>
>         </xsl:when>
>         <xsl:otherwise>
>           <tab title="{../../fi:hint}" href="#"
> onclick="document.cform.{../../@id}.value = '{@value}';
> forms_submitForm(this, '{../../@id}'); return false"><xsl:value-of
> select="fi:label"/></tab>
>         </xsl:otherwise>
>       </xsl:choose>
>     </xsl:for-each>
>   </xsl:template>
> 
> The tab-elements are rendered by my display stylesheets.

Stylings for AJAX require that they are self-contained within a single 
element, whose id is equal to that of the widget.  That way when the 
widget indicates it needs to be updated, the AJAX code knows where to 
insert its replacement in the DOM.

If you wrap the contents of your styling within a single
<span id="{@id}">...</span> it should work.  See the built-in 
forms-field-styling.xsl stylings for more examples.

--Jason


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


Mime
View raw message