[CLOSED] FormPanel renderization bug when LabelAlign and MsgTarget are set

  1. #1

    [CLOSED] FormPanel renderization bug when LabelAlign and MsgTarget are set

    When button1 is clicked, the data is loaded and the the form renders correctly because the data meets the form´s requirements. basically, the Name field of Form does not allow blank text and the data loaded has this property filled.

    Click image for larger version. 

Name:	Img00001.jpg 
Views:	83 
Size:	11.7 KB 
ID:	4116

    But when i click button2 AFTER clicking button1 the data loaded does not this property filled and the following bug occurs.

    Click image for larger version. 

Name:	Img00002.jpg 
Views:	74 
Size:	11.3 KB 
ID:	4117

    it happens because the LabelAlign property is set to Top and MsgTarget property is set to Side

    Any ideas to overcome this problem?

    <ext:FormPanel ID="FormPanel1" runat="server" Title="Form Panel" Width="300">
        <FieldDefaults LabelAlign="Top" MsgTarget="Side" />
        <Items>
            <ext:TextField Name="ID"  FieldLabel="ID" AnchorHorizontal="100%" runat="server" />
            <ext:TextField Name="Name" FieldLabel="Name" AllowBlank="false" AnchorHorizontal="100%" runat="server" />
        </Items>
        <Buttons>
            <ext:Button ID="button1" runat="server" Text="Old">
                <Listeners>
                    <Click Handler="loadRecord(false);" />
                </Listeners>
            </ext:Button>
            <ext:Button ID="button2" runat="server" Text="New">
                <Listeners>
                    <Click Handler="loadRecord(true);" />
                </Listeners>
            </ext:Button>
        </Buttons>
        <Bin>
            <ext:Store ID="Store2" runat="server" AutoLoad="false" PageSize="1">
                <Model>
                    <ext:Model ID="Model2" IDProperty="ID" runat="server">
                        <Fields>
                            <ext:ModelField Name="ID" />
                            <ext:ModelField Name="Name" />
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
        </Bin>
    </ext:FormPanel>
    <script type="text/javascript">
        var loadRecord = function (loadNew) {
    
            Ext.net.DirectMethod.request({
                url: "/Example/Test",
                cleanRequest: true,
                params: {
                    loadNew: loadNew
                },
                success: function (result) {
                    App.Store2.loadRawData(result);
    
                    var record = App.Store2.getAt(0);
    
                    App.FormPanel1.getForm().loadRecord(record);
                }
            });
        }
    </script>
    public AjaxResult Test(bool loadNew)
    {
        AjaxResult ajx = new AjaxResult();
    
        if (loadNew)
        {
            ajx.Result = new Person();
        }
        else
        {
            ajx.Result = new Person { ID = 1, Name = "EXT"};
        }
    
        return ajx;
    }
    Last edited by Daniil; Apr 20, 2012 at 6:55 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please try to call the doLayout method after loading a record.
    App.FormPanel1.getForm().loadRecord(record);
    App.FormPanel1.doLayout();
  3. #3
    Unfortunately it does not work even if doLayout method is called.
  4. #4
    We are unable to reproduce the problem using the following example.

    Is it reproducible on your side?

    Do you use the last Ext.NET sources from SVN?

    What browser do you test with?

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Examples</title>
        
        <script type="text/javascript">
            var loadRecord = function (loadNew) {
                if (loadNew) {
                    App.FormPanel1.getForm().setValues({ Name : "", ID : 0 });
                } else {
                    App.FormPanel1.getForm().setValues({ Name : "EXT", ID : 1 });
                }
            }
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:FormPanel  
                ID="FormPanel1" 
                runat="server" 
                Title="Form Panel" 
                Width="300">
                <FieldDefaults LabelAlign="Top" MsgTarget="Side" />
                <Items>
                    <ext:TextField
                        runat="server" 
                        Name="ID" 
                        FieldLabel="ID" 
                        AnchorHorizontal="100%" />
                    <ext:TextField
                        runat="server"
                        Name="Name" 
                        FieldLabel="Name" 
                        AllowBlank="false" 
                        AnchorHorizontal="100%" />
                </Items>
                <Buttons>
                    <ext:Button runat="server" Text="Old">
                        <Listeners>
                            <Click Handler="loadRecord(false);" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button runat="server" Text="New">
                        <Listeners>
                            <Click Handler="loadRecord(true);" />
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:FormPanel>
        </form>
    </body>
    </html>
  5. #5
    I tested on IE 8.0.7600.16385. After you post i tested it on Chrome and it worked. Is the version 8.0 of IE supported?
  6. #6
    Yes, IE8 is still supported.

    I've reproduced the problem in IE8. We will investigate a possible fix.
  7. #7
    Thank you Daniil
  8. #8
    The fix has been added to SVN, please update.

Similar Threads

  1. tabpanel in forpanel and wrong MsgTarget
    By threewonders in forum 1.x Help
    Replies: 2
    Last Post: May 14, 2012, 7:32 AM
  2. [CLOSED] IE6, compositefield with labelalign=top
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 22, 2011, 6:45 PM
  3. [CLOSED] Need PanelField w/markInvalid() & MsgTarget support
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 31, 2010, 6:48 PM
  4. [CLOSED] Different labelalign within a FormPanel
    By jchau in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 09, 2010, 2:23 AM
  5. [CLOSED] [1.0] LabelAlign
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 13, 2010, 5:48 PM

Posting Permissions