PDA

View Full Version : [CLOSED] FileUploadFile cleared right after submit



bogc
Jan 15, 2013, 12:54 AM
Sample to reproduce below. Select a file then hit save. The content of the FileUploadField textbox is cleared and the empty text is shown. Am I missing something?

I tested with the latest SVN trunk as of right now and I also reproduced the problem in Ext.net 2.1.1.


<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>


<!DOCTYPE html>

<html>
<head id="Head1" runat="server">
<title>FormPanel - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />

<style>
#fi-button-msg {
border: 2px solid #ccc;
padding: 5px 10px;
background: #eee;
margin: 5px;
float: left;
}
</style>

</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<form id="Form1" runat="server">


<h2>Form Example</h2>

<p>The FileUploadField can also be used in standard form layouts, with support for anchoring, validation (the
field is required in this example), empty text, etc.</p>

<ext:FormPanel
ID="BasicForm"
runat="server"
Width="500"
Frame="true"
Title="File Upload Form"
PaddingSummary="10px 10px 0 10px"
LabelWidth="50"
Url=".">
<Defaults>
<ext:Parameter Name="anchor" Value="95%" Mode="Value" />
<ext:Parameter Name="allowBlank" Value="false" Mode="Raw" />
<ext:Parameter Name="msgTarget" Value="side" Mode="Value" />
</Defaults>
<Items>
<ext:FileUploadField
ID="FileUploadField1"
runat="server"
EmptyText="Select an image"
FieldLabel="Photo"
ButtonText=""
Icon="ImageAdd"
/>
</Items>

<Buttons>
<ext:Button ID="SaveButton" runat="server" Text="Save" >
<Listeners>
<Click Handler="#{BasicForm}.getForm().submit();">
</Click>
</Listeners>
</ext:Button>
<ext:Button ID="Button2" runat="server" Text="Reset">
<Listeners>
<Click Handler="#{BasicForm}.getForm().reset();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:FormPanel>
</form>
</body>
</html>

bogc
Jan 15, 2013, 1:58 AM
After debugging more, it seems that the problem is in this source, ext-4.1.1a\src\form\field\File.js, the call to the field reset().


extractFileInput: function() {
var fileInput = this.fileInputEl.dom;
this.reset();
return fileInput;
},

I created this bug:
http://www.sencha.com/forum/showthread.php?253857-FileUploadField-reset-upon-form-submit&p=929276

Daniil
Jan 15, 2013, 4:03 AM
Hi @bogc,

I reported it earlier.
http://www.sencha.com/forum/showthread.php?202912

Here is a related Ext.NET forum thread.
http://forums.ext.net/showthread.php?18833

Your post led us to know that they already added the clearOnSubmit option. Thank you.

We added a respective server property for FileUploadField (trunk).

bogc
Jan 15, 2013, 4:42 AM
Thank you, Daniil.

Just as a side note I searched both forums (sencha and ext.net) for an issue related - I thought I can't be the first one finding this, and I was right :-) - but I couldn't find anything so I decided to create the bug report. I searched for: FileUploadField clear. The other thread that you mentioned didn't come up because it didn't contain FileUploadField. I often use the Search Forum feature which I think it is not as good as the google search. For instance google might decide to search substrings and infer cleared->clear or the other way.

Thanks again

Daniil
Jan 15, 2013, 5:05 AM
First of all, it is totally not a problem that you posted it. It even gave as a real benefit - we knew that the clearOnSubmit option appeared.

It is a common case for me when I reports duplicates to Sencha forums. Recently, I even reported a duplicate of my own report:)


I often use the Search Forum feature which I think it is not as good as the google search.

Please notice that Google search is available for Ext.NET forums. The "Search" box at the top on the right.

bogc
Jan 15, 2013, 5:17 AM
Is there a way to search only the Ext.Net 2.x posts using the google search you suggested?

Daniil
Jan 15, 2013, 5:58 AM
I don't know such an option. I am afraid there is no.