v2.1.1 - FileUpload (bug?) and Disabled Fields

  1. #1

    v2.1.1 - FileUpload (bug?) and Disabled Fields

    Hello,

    I have found this issue on v2.1.1:
    - By default disabled fields are submitted, but if you put a fileupload field inside a form tag all disabled fields are not submitted regardless of resource manager configuration.

    Here's an example:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestFileUpload.aspx.cs" Inherits="Test.TestFileUpload" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" SubmitDisabled="true" />
        <ext:Button runat="server" Text="Submit">
            <DirectEvents>
                <Click OnEvent="Submit_Click" />
            </DirectEvents>
        </ext:Button>
    
        <ext:TextField ID="txtField1" runat="server" Disabled="true"/>
    
        </form>
    </body>
    </html>
    Server-side code:
    using System;
    using Ext.Net;
    
    namespace Test
    {
        public partial class TestFileUpload : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!X.IsAjaxRequest)
                {
                    txtField1.Text = "test123";
                }
            }
            protected void Submit_Click(object sender, DirectEventArgs e)
            {
                X.MessageBox.Alert("Result", string.Format("Result: '{0}'", txtField1.Text)).Show();
            }
        }
    }
    In the above code you can see the message with the value 'test123' when you submit.

    Now, if you put a fileupload field inside the form tag, for instance bellow the textfield:
    <ext:FileUploadField runat="server" ID="fupload" />

    and submit, the message shows the value ''.

    Can you please provide a workaround this issue (i really need the disabled state instead readonly)?

    Best regards.
  2. #2
    According W3C standards, disabled input fields are never submitable
    We can submit disabled fields during direct request only (ajax request)

    If file upload field is used then we cannot use ajax request (because ajax request cannot upload files (cannot transmit binary data) )
    In this case, we create hidden iframe with html form and initiate native submit for that html form
    As I said before, native html form never submits disabled inputs

    Therefore your scenario will not work. If you cannot replace Disabled to ReadOnly then I can suggest to pass disabled fields as extra parameters of direct event
  3. #3
    Quote Originally Posted by Vladimir View Post
    According W3C standards, disabled input fields are never submitable
    We can submit disabled fields during direct request only (ajax request)

    If file upload field is used then we cannot use ajax request (because ajax request cannot upload files (cannot transmit binary data) )
    In this case, we create hidden iframe with html form and initiate native submit for that html form
    As I said before, native html form never submits disabled inputs

    Therefore your scenario will not work. If you cannot replace Disabled to ReadOnly then I can suggest to pass disabled fields as extra parameters of direct event
    Got it! Thank you for your quick reply. You can mark this post as Closed.

Similar Threads

  1. [CLOSED] [MVC] FileUpload in MVC
    By UnifyEducation in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 27, 2015, 4:03 PM
  2. [CLOSED] Disabled fields don't get submitted
    By zwf in forum 2.x Legacy Premium Help
    Replies: 7
    Last Post: Nov 01, 2012, 11:47 AM
  3. Display problem with disabled fields
    By Stefanaccio in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Aug 27, 2010, 6:14 PM
  4. Replies: 7
    Last Post: Aug 12, 2009, 4:04 PM
  5. bug in fileupload
    By pablisho in forum 1.x Help
    Replies: 0
    Last Post: Jul 01, 2009, 10:55 AM

Posting Permissions