[
http://issues.apache.org/jira/browse/COCOON-1846?page=comments#action_12378853
]
vincent Demay commented on COCOON-1846:
---------------------------------------
Hello, thanks for you answer
first I think using name() = 'fi:booleanfield' is better than local-name()
because we stay in the namspace prefix.
I get the [<xsl:if test="@listening = 'true' and
not(fi:styling/@submit-on-change = 'false') and not(fi:styling/@onchange) and
not(fi:styling/@list-type = 'double-listbox')">] condition in my
forms-field-styling.xsl version which is in my current cocoon version (2.1.9).
It seems to not allow submit if submit-on-change is not true and if list-type
is double-listbox (It's classical html inpu in this case). I think this last
condition is not mandatory in the onclick-case.
I don't know exactly what is the purpose of @listening='true' but I think it is
added on fi:* when the widget is supposed to handle events. I made some tests
and it is setted by jx-generator when using
org/apache/cocoon/forms/generation/jx-macros.xml.
So I think we can clean up my patch as :
--- forms-field-styling.xsl 2006-05-09 14:53:40.014409000 +0200
+++ forms-field-styling.xsl 2006-05-09 14:45:01.499752000 +0200
@@ -91,11 +91,20 @@
+-->
<xsl:template match="fi:*" mode="styling">
<xsl:apply-templates select="fi:styling/@*" mode="styling"/>
-
<!-- Auto submit on fields which are listening -->
- <xsl:if test="@listening = 'true' and not(fi:styling/@submit-on-change
='false') and not(fi:styling/@onchange) and not(fi:styling/@list-type =
'double-listbox')">
- <xsl:attribute name="onchange">forms_submitForm(this)</xsl:attribute>
- </xsl:if>
+ <xsl:choose>
+ <xsl:when test="name() = 'fi:booleanfield' or
fi:styling/@list-type='checkbox' or fi:styling/@list-type = 'radio' ">
+ <xsl:if test="@listening = 'true' and not(fi:styling/@submit-on-change =
'false') and not(fi:styling/@onchange)">
+ <xsl:attribute name="onclick">forms_submitForm(this)</xsl:attribute>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="@listening = 'true' and not(fi:styling/@submit-on-change =
'false') and not(fi:styling/@onchange) and not(fi:styling/@list-type
='double-listbox')">
+ <xsl:attribute name="onchange">forms_submitForm(this)</xsl:attribute>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+
<xsl:if test="@state = 'disabled'">
<xsl:attribute name="disabled">disabled</xsl:attribute>
I hope my answer is usefull for you
> [PATCH] BooleanField and radio do not send on-value-changed at the rigth time
> with IE
> -------------------------------------------------------------------------------------
>
> Key: COCOON-1846
> URL: http://issues.apache.org/jira/browse/COCOON-1846
> Project: Cocoon
> Type: Bug
> Components: Blocks: Forms
> Versions: 2.1.9
> Reporter: vincent Demay
> Assignee: Simone Gianni
>
> BooleanField and radio list do not send on-value-changed event when the value
> changed but when the widget loose focus with IE.
> So with ajax mode and submit-on-change='true', the form is submitted only
> when the widget lost the focus.
> Here is a patch to use event onclick rather than on value change :
> --- forms-field-styling.xsl 2006-05-09 14:53:40.014409000 +0200
> +++ forms-field-styling.xsl 2006-05-09 14:45:01.499752000 +0200
> @@ -91,11 +91,20 @@
> +-->
> <xsl:template match="fi:*" mode="styling">
> <xsl:apply-templates select="fi:styling/@*" mode="styling"/>
> -
> <!-- Auto submit on fields which are listening -->
> - <xsl:if test="@listening = 'true' and not(fi:styling/@submit-on-change
> ='false') and not(fi:styling/@onchange) and not(fi:styling/@list-type =
> 'double-listbox')">
> - <xsl:attribute name="onchange">forms_submitForm(this)</xsl:attribute>
> - </xsl:if>
> + <xsl:choose>
> + <xsl:when test="name() = 'fi:booleanfield' or fi:styling/@list-type =
> 'radio' ">
> + <xsl:if test="@listening = 'true' and
> not(fi:styling/@submit-on-change = 'false') and not(fi:styling/@onchange) and
> not(fi:styling/@list-type = 'double-listbox')">
> + <xsl:attribute
> name="onclick">forms_submitForm(this)</xsl:attribute>
> + </xsl:if>
> + </xsl:when>
> + <xsl:otherwise>
> + <xsl:if test="@listening = 'true' and
> not(fi:styling/@submit-on-change = 'false') and not(fi:styling/@onchange) and
> not(fi:styling/@list-type ='double-listbox')">
> + <xsl:attribute
> name="onchange">forms_submitForm(this)</xsl:attribute>
> + </xsl:if>
> + </xsl:otherwise>
> + </xsl:choose>
> +
> <xsl:if test="@state = 'disabled'">
> <xsl:attribute name="disabled">disabled</xsl:attribute>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira