[ 
http://issues.apache.org/jira/browse/COCOON-1780?page=comments#action_12367339 
] 

vincent Demay commented on COCOON-1780:
---------------------------------------

What do you think of doing something like that to keep your idea (in order to 
avoid useless code): 

Index: 
/cvs/cocoon/cocoon_BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java
===================================================================
--- 
/cvs/cocoon/cocoon_BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java
 (revision 379761)
+++ 
/cvs/cocoon/cocoon_BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java
 (working copy)
@@ -105,11 +105,6 @@
 
         Object obj = request.get(fullId);
 
-        if (fullId.equals(request.getParameter(Form.SUBMIT_ID_PARAMETER))) {
-           form.setSubmitWidget(this);
-        }
-
-
         // If the request object is a Part, keep it
         if (obj instanceof Part) {
             Part requestPart = (Part)obj;
@@ -129,7 +124,7 @@
 
         // If it's not a part and not null, clear any existing value
         // We also check if we're the submit widget, as a result of clicking 
the "..." button
-        } else if (obj != null || form.getSubmitWidget() == this){
+        } else if (obj != null || 
fullId.equals(request.getParameter(Form.SUBMIT_ID_PARAMETER))){
             // Clear the part, if any
             if (this.part != null) {
                 this.part.dispose();



or, and I think it's better because, replace the button by a submit and remove 
the useless condition as in the following patch
Index: 
/cvs/cocoon/cocoon_BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java
===================================================================
--- 
/cvs/cocoon/cocoon_BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java
 (revision 379761)
+++ 
/cvs/cocoon/cocoon_BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java
 (working copy)
@@ -105,11 +105,6 @@
 
         Object obj = request.get(fullId);
 
-        if (fullId.equals(request.getParameter(Form.SUBMIT_ID_PARAMETER))) {
-           form.setSubmitWidget(this);
-        }
-
-
         // If the request object is a Part, keep it
         if (obj instanceof Part) {
             Part requestPart = (Part)obj;
@@ -129,7 +124,7 @@
 
         // If it's not a part and not null, clear any existing value
         // We also check if we're the submit widget, as a result of clicking 
the "..." button
-        } else if (obj != null || form.getSubmitWidget() == this){
+        } else if (obj != null){
             // Clear the part, if any
             if (this.part != null) {
                 this.part.dispose();


> [PATCH] Upload Widget : Can not change selected file
> ----------------------------------------------------
>
>          Key: COCOON-1780
>          URL: http://issues.apache.org/jira/browse/COCOON-1780
>      Project: Cocoon
>         Type: Bug
>   Components: Blocks: Forms
>     Versions: 2.2-dev (Current SVN), 2.1.9-dev (current SVN)
>     Reporter: vincent Demay
>     Assignee: Jean-Baptiste Quenot
>      Fix For: 2.1.9-dev (current SVN)

>
> When a file is selected with the upload widget and a on-value-change event is 
> fired, the value of the widget can not be changed by user.
> here is the patch
> Index: 
> /cvs/cocoon/cocoon_BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl
> ===================================================================
> --- 
> /cvs/cocoon/cocoon_BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl
>    (revision 377974)
> +++ 
> /cvs/cocoon/cocoon_BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/resources/forms-field-styling.xsl
>    (working copy)
> @@ -486,7 +486,7 @@
>              <xsl:text>[</xsl:text>
>              <xsl:value-of select="fi:value"/>
>              <xsl:text>] </xsl:text>
> -            <input type="button" id="[EMAIL PROTECTED]:input" name="[EMAIL 
> PROTECTED]" value="..." onclick="forms_submitForm(this)"/>
> +           <input type="submit" id="[EMAIL PROTECTED]:input" name="[EMAIL 
> PROTECTED]" value="..." onclick="forms_submitForm(this)"/>
>          </xsl:when>
>          <xsl:otherwise>
>            <input type="file" id="[EMAIL PROTECTED]:input" name="[EMAIL 
> PROTECTED]" title="{fi:hint}" accept="[EMAIL PROTECTED]">

-- 
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