You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter Velychko <v_...@ukr.net> on 2004/07/01 18:00:15 UTC

fd:upload unexpected behaviour

Hello users,

I've found some unexpected behaviour for me when using <fd:upload/>.

When one uploads some file with forbidden content type validation
error arises for the widget. The result view contains error messages.
When the form contains also other errors user can press button of
upload wibget and upload another file. All is ok.
But if the error from upload widget is single on the form hitting
upload widget's button leads to simple form submit with passing to
next form.
So user cannot reupload file uploaded first time mistakenly.

Could someone help me with this problem?

Thank you in advance.

-- 
Best regards,
Peter Velychko                         
v_peter@ukr.net


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


Re: fd:upload unexpected behaviour

Posted by Peter Velychko <v_...@ukr.net>.
Hello Joerg,

Friday, July 2, 2004, 2:44:09 AM, you wrote:

> On 01.07.2004 20:55, Peter Velychko wrote:

>> But try the sample with two upload widgets that are not required (see
>> example below).
>> 
>> <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
>>          xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
>>   <fd:widgets>
>>     <fd:field id="user" required="true">
>>       <fd:datatype base="string"/>
>>       <fd:label>User name</fd:label>
>>     </fd:field>
>>     <fd:upload id="upload" mime-types="text/plain">
>>       <fd:label>Upload a text file</fd:label>
>>       <fd:hint>You must choose a text file</fd:hint>
>>     </fd:upload>
>>     <fd:upload id="upload2" mime-types="text/plain">
>>       <fd:label>Upload a text file</fd:label>
>>       <fd:hint>You must choose a text file</fd:hint>
>>     </fd:upload>
>>   </fd:widgets>
>> </fd:form>

> Confirmed. The reason: the click on the button releases the uploaded 
> file and sets the field part of the upload widget to null. On validating 
> this it does not cause an error of course (while it caused one and 
> worked like expected when having required="true"). The important 
> difference is now that the button "..." you click on is not different to 
> the normal submit widget, the form does not know that this submit was 
> indeed only an action. For fixing it the request parameter 
> 'forms_submit_id' must be set to the upload widget's id.
Yes, it is so. (I spent my evening time on investigating the issue)

> Fixed it in CVS.
Thank you very much. I'll upgrade cocoon to current CVS.

> Joerg

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

-- 
Best regards,
Peter Velychko                            
v_peter@ukr.net


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


Re: fd:upload unexpected behaviour

Posted by Joerg Heinicke <jo...@gmx.de>.
On 01.07.2004 20:55, Peter Velychko wrote:

> But try the sample with two upload widgets that are not required (see
> example below).
> 
> <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
>          xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
>   <fd:widgets>
>     <fd:field id="user" required="true">
>       <fd:datatype base="string"/>
>       <fd:label>User name</fd:label>
>     </fd:field>
>     <fd:upload id="upload" mime-types="text/plain">
>       <fd:label>Upload a text file</fd:label>
>       <fd:hint>You must choose a text file</fd:hint>
>     </fd:upload>
>     <fd:upload id="upload2" mime-types="text/plain">
>       <fd:label>Upload a text file</fd:label>
>       <fd:hint>You must choose a text file</fd:hint>
>     </fd:upload>
>   </fd:widgets>
> </fd:form>

Confirmed. The reason: the click on the button releases the uploaded 
file and sets the field part of the upload widget to null. On validating 
this it does not cause an error of course (while it caused one and 
worked like expected when having required="true"). The important 
difference is now that the button "..." you click on is not different to 
the normal submit widget, the form does not know that this submit was 
indeed only an action. For fixing it the request parameter 
'forms_submit_id' must be set to the upload widget's id.

Fixed it in CVS.

Joerg

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


Re: fd:upload unexpected behaviour

Posted by Peter Velychko <v_...@ukr.net>.
Hello Joerg,

Let me to specify conditions.
The samples of both 2.1.5 and CVS work ok.
But they have one upload widget with attribute 'reqired="true"'.
But try the sample with two upload widgets that are not required (see
example below).
The behaviour described becomes apparent in that case.

<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
         xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
  <fd:widgets>
    <fd:field id="user" required="true">
      <fd:datatype base="string"/>
      <fd:label>User name</fd:label>
    </fd:field>
    <fd:upload id="upload" mime-types="text/plain">
      <fd:label>Upload a text file</fd:label>
      <fd:hint>You must choose a text file</fd:hint>
    </fd:upload>
    <fd:upload id="upload2" mime-types="text/plain">
      <fd:label>Upload a text file</fd:label>
      <fd:hint>You must choose a text file</fd:hint>
    </fd:upload>
  </fd:widgets>
</fd:form>


Thursday, July 1, 2004, 9:06:42 PM, you wrote:

> On 01.07.2004 18:00, Peter Velychko wrote:

>> Hello users,
>> 
>> I've found some unexpected behaviour for me when using <fd:upload/>.
>> 
>> When one uploads some file with forbidden content type validation
>> error arises for the widget. The result view contains error messages.
>> When the form contains also other errors user can press button of
>> upload wibget and upload another file. All is ok.
>> But if the error from upload widget is single on the form hitting
>> upload widget's button leads to simple form submit with passing to
>> next form.
>> So user cannot reupload file uploaded first time mistakenly.
>> 
>> Could someone help me with this problem?

> I can not confirm it, tried it with the upload sample. The widget and 
> its validation behave like expected.

> Joerg

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

-- 
Best regards,
Peter Velychko                            
v_peter@ukr.net


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


Re: fd:upload unexpected behaviour

Posted by Joerg Heinicke <jo...@gmx.de>.
On 01.07.2004 18:00, Peter Velychko wrote:

> Hello users,
> 
> I've found some unexpected behaviour for me when using <fd:upload/>.
> 
> When one uploads some file with forbidden content type validation
> error arises for the widget. The result view contains error messages.
> When the form contains also other errors user can press button of
> upload wibget and upload another file. All is ok.
> But if the error from upload widget is single on the form hitting
> upload widget's button leads to simple form submit with passing to
> next form.
> So user cannot reupload file uploaded first time mistakenly.
> 
> Could someone help me with this problem?

I can not confirm it, tried it with the upload sample. The widget and 
its validation behave like expected.

Joerg

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