You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2005/12/05 06:10:09 UTC
svn commit: r353990 -
/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl
Author: antonio
Date: Sun Dec 4 21:10:05 2005
New Revision: 353990
URL: http://svn.apache.org/viewcvs?rev=353990&view=rev
Log:
Enable AJAX for fi:multivaluefield with list-type='double-listbox' styling.
Modified:
cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl
Modified: cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl
URL: http://svn.apache.org/viewcvs/cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl?rev=353990&r1=353989&r2=353990&view=diff
==============================================================================
--- cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl (original)
+++ cocoon/blocks/forms/trunk/java/org/apache/cocoon/forms/resources/forms-advanced-field-styling.xsl Sun Dec 4 21:10:05 2005
@@ -84,7 +84,9 @@
<xsl:template match="fi:multivaluefield[fi:styling/@list-type='double-listbox']">
<xsl:variable name="id" select="@id"/>
<xsl:variable name="values" select="fi:values/fi:value/text()"/>
+ <xsl:variable name="browser-variable"><xsl:value-of select="translate($id, '.', '_')"/>_jsWidget</xsl:variable>
+ <script type="text/javascript">var <xsl:value-of select="$browser-variable"/>;</script>
<div id="{@id}" class="forms-doubleList" title="{fi:hint}">
<table>
<xsl:if test="fi:styling/fi:available-label|fi:styling/fi:selected-label">
@@ -102,7 +104,7 @@
<td>
<!-- select for the unselected values -->
<select id="{@id}.unselected" name="{@id}.unselected" multiple="multiple"
- ondblclick="opt{generate-id()}.forms_transferRight()">
+ ondblclick="{$browser-variable}.forms_transferRight()">
<xsl:apply-templates select="." mode="styling"/>
<xsl:for-each select="fi:selection-list/fi:item">
<xsl:variable name="value" select="@value"/>
@@ -118,7 +120,7 @@
<!-- command buttons -->
<!-- strangely, IE adds an extra blank line if there only a button on a line. So we surround it with nbsp -->
<xsl:text> </xsl:text>
- <input type="button" value=">" onclick="opt{generate-id()}.forms_transferRight()">
+ <input type="button" value=">" onclick="{$browser-variable}.forms_transferRight()">
<xsl:if test="@state='disabled'">
<xsl:attribute name="disabled">disabled</xsl:attribute>
</xsl:if>
@@ -126,7 +128,7 @@
<xsl:text> </xsl:text>
<br/>
<xsl:text> </xsl:text>
- <input type="button" value=">>" onclick="opt{generate-id()}.forms_transferAllRight()">
+ <input type="button" value=">>" onclick="{$browser-variable}.forms_transferAllRight()">
<xsl:if test="@state='disabled'">
<xsl:attribute name="disabled">disabled</xsl:attribute>
</xsl:if>
@@ -134,7 +136,7 @@
<xsl:text> </xsl:text>
<br/>
<xsl:text> </xsl:text>
- <input type="button" value="<" onclick="opt{generate-id()}.forms_transferLeft()">
+ <input type="button" value="<" onclick="{$browser-variable}.forms_transferLeft()">
<xsl:if test="@state='disabled'">
<xsl:attribute name="disabled">disabled</xsl:attribute>
</xsl:if>
@@ -142,7 +144,7 @@
<xsl:text> </xsl:text>
<br/>
<xsl:text> </xsl:text>
- <input type="button" value="<<" onclick="opt{generate-id()}.forms_transferAllLeft()">
+ <input type="button" value="<<" onclick="{$browser-variable}.forms_transferAllLeft()">
<xsl:if test="@state='disabled'">
<xsl:attribute name="disabled">disabled</xsl:attribute>
</xsl:if>
@@ -154,7 +156,7 @@
<td>
<!-- select for the selected values -->
<select id="{@id}:input" name="{@id}" multiple="multiple"
- ondblclick="opt{generate-id()}.forms_transferLeft()" >
+ ondblclick="{$browser-variable}.forms_transferLeft()" >
<xsl:apply-templates select="." mode="styling"/>
<xsl:for-each select="fi:selection-list/fi:item">
<xsl:variable name="value" select="@value"/>
@@ -168,9 +170,7 @@
</td>
</tr>
</table>
- <script type="text/javascript">
- var opt<xsl:value-of select="generate-id()"/> = forms_createOptionTransfer('<xsl:value-of select="@id"/>', <xsl:value-of select="fi:styling/@submit-on-change = 'true'"/>);
- </script>
+ <script type="text/javascript"><xsl:value-of select="$browser-variable"/> = forms_createOptionTransfer('<xsl:value-of select="@id"/>', <xsl:value-of select="fi:styling/@submit-on-change = 'true'"/>);</script>
</div>
</xsl:template>