[CLOSED] the hidden field does not retain value

  1. #1

    [CLOSED] the hidden field does not retain value

    Last edited by Daniil; Mar 12, 2013 at 4:24 AM. Reason: [CLOSED]
  2. #2
  3. #3
    Hello,

    Thank you for the report. Please use the following fix for now.

    Fix
    <script>
        Ext.form.field.Hidden.override({
            afterRender : function () {
                this.inputEl = this.el;
                this.labelEl = this.el;
                this.bodyEl = this.el;
                this.errorEl = this.el;
                this.inputRow = this.el;
    
                if (Ext.isDefined(this.value)) { // if (this.value) {
                    this.originalValue = this.lastValue = this.value;
                    this.el.dom.value = this.value;
                }
            
                this.callParent();
            }
        });
    </script>
    Here is a full test case.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.Hidden1.Value = 0;
            }
        }
    
        protected void GetHiddenValue(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("Hidden.Value", this.Hidden1.Value).Show();
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script>
            Ext.form.field.Hidden.override({
                afterRender : function () {
                    this.inputEl = this.el;
                    this.labelEl = this.el;
                    this.bodyEl = this.el;
                    this.errorEl = this.el;
                    this.inputRow = this.el;
    
                    if (Ext.isDefined(this.value)) { // if (this.value) {
                        this.originalValue = this.lastValue = this.value;
                        this.el.dom.value = this.value;
                    }
            
                    this.callParent();
                }
            });
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:Hidden ID="Hidden1" runat="server" />
            <ext:Button runat="server" Text="Test" OnDirectClick="GetHiddenValue" />
        </form>
    </body>
    </html>
  4. #4
    Quote Originally Posted by Daniil View Post
    Hello,

    Thank you for the report. Please use the following fix for now.

    Fix
    <script>
        Ext.form.field.Hidden.override({
            afterRender : function () {
                this.inputEl = this.el;
                this.labelEl = this.el;
                this.bodyEl = this.el;
                this.errorEl = this.el;
                this.inputRow = this.el;
    
                if (Ext.isDefined(this.value)) { // if (this.value) {
                    this.originalValue = this.lastValue = this.value;
                    this.el.dom.value = this.value;
                }
            
                this.callParent();
            }
        });
    </script>
    Here is a full test case.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.Hidden1.Value = 0;
            }
        }
    
        protected void GetHiddenValue(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("Hidden.Value", this.Hidden1.Value).Show();
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script>
            Ext.form.field.Hidden.override({
                afterRender : function () {
                    this.inputEl = this.el;
                    this.labelEl = this.el;
                    this.bodyEl = this.el;
                    this.errorEl = this.el;
                    this.inputRow = this.el;
    
                    if (Ext.isDefined(this.value)) { // if (this.value) {
                        this.originalValue = this.lastValue = this.value;
                        this.el.dom.value = this.value;
                    }
            
                    this.callParent();
                }
            });
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:Hidden ID="Hidden1" runat="server" />
            <ext:Button runat="server" Text="Test" OnDirectClick="GetHiddenValue" />
        </form>
    </body>
    </html>

    ok thanks will do that
  5. #5
    It has been fixed in SVN trunk (v2.2).

    Thank you again for the report!

Similar Threads

  1. Hidden Field and preset Value causes error
    By Bubu in forum 1.x Help
    Replies: 3
    Last Post: Feb 13, 2012, 1:00 AM
  2. [CLOSED] Problems with Hidden Field after SVN Update
    By macap in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: May 23, 2011, 11:12 AM
  3. Replies: 0
    Last Post: May 06, 2010, 4:20 PM
  4. [CLOSED] Hidden field problem
    By tdracz in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 12, 2008, 1:39 PM
  5. [CLOSED] Hidden field question
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 12, 2008, 9:18 AM

Posting Permissions