[CLOSED] Form: check if it's dirty

  1. #1

    [CLOSED] Form: check if it's dirty

    Hello,

    I want to check if a form was modified so I use the IsDirty method like this

     
    tab.getBody().formPanel.isDirty()
    Unfortunatelly it always return true even if no modification was made to the form. Is it a bug? Or how can I check is the form was modified or not?

    Romuald.
    Last edited by geoffrey.mcgill; Jul 20, 2010 at 5:20 AM.
  2. #2
    Hi,

    Please provide own test sample
    Here is my test case which works fine

    Main page
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!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 runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:Window ID="Window1" runat="server" Width="300" Height="200" Title="Window">
                <AutoLoad Url="Child.aspx" Mode="IFrame">                
                </AutoLoad>
                
                <Buttons>
                    <ext:Button runat="server" Text="Is Dirty">
                        <Listeners>
                            <Click Handler="alert('Dirty=' + #{Window1}.getBody().formPanel.isDirty());" />
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:Window>
        </form>
    </body>
    </html>
    Iframe child page
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!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 id="Head1" runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
            
            <ext:Viewport runat="server" Layout="Fit">
                <Items>
                    <ext:FormPanel ID="formPanel" runat="server">
                        <Items>
                            <ext:TextField runat="server" Text="Original value" />
                            <ext:TextField runat="server" />
                            <ext:DateField runat="server" />
                            <ext:ComboBox runat="server" />
                        </Items>
                    </ext:FormPanel>
                </Items>
            </ext:Viewport>
        </form>
    </body>
    </html>
  3. #3
    Hello,
    Here is an example. It's not complete but it gives you the structure

    First of all I have a TabPanel with the following code

    <ext:TabPanel ID="MainTab" runat="server">
        <Listeners>
           <BeforeTabClose Fn="confirmTabClose" />
        </Listeners>
    </ext:TabPanel>
    Tabs are added to this TabPanel in javascript with the following code

    Ext.getCmp(?MainTab?).addTab({
                            id: id,
                            title: 'titre',
                            closable: true,
                            autoLoad: {
                                showMask: true,
                                url: url,
                                mode: 'iframe',
                                noCache: true,
                                scripts: true
                            }
                        });
    The beforetabClose calls the following function. In this function I want to check the isDirty of the form

     
    function confirmTabClose(tab){
          tab.getBody().formPanel.isDirty()
    }
    Each Tab is defined as follow

    <ext:FormPanel ID="formPanel" runat="server" Url="url">
     <Items>
    ?
    </Items>
    </ext :FormPanel>
    Thanks,
    Romuald.
    Last edited by geoffrey.mcgill; Jul 15, 2010 at 11:21 PM.
  4. #4
    Hi,

    We need iframe page source code. As you can see in my example 'isDirty' method works corretly. Please provide iframe page which is loaded inside tab
  5. #5
    Hello,

    I already provide the iframe code. It was the code I gave at the end of my previous thread and meant each frame is defined as follow.
    Here is it again

    <ext:Viewport ID="viewPort" runat="server" Layout="Fit">
            <Items>
                <ext:FormPanel ID="formPanel" runat="server" Url=?url">
                      <Items>
    ?
    </Items>
    </ext :FormPanel>
       </Items>
    </ext:Viewport
    Romuald.
  6. #6
    Hi,

    I don't see any fields inside FormPanel. Do you check empty FormPanel?
  7. #7
    Hi,

    Here is a new version

     
    <ext:Viewport ID="viewPort" runat="server" Layout="Fit">
            <Items>
                <ext:FormPanel ID="formPanel" runat="server" Url=?url">
                      <Items>
    <ext:TabPanel ID="tabPanel" runat="server" DeferredRender="false">
                                <ext:Panel ID="tabNote" Title="Titre" runat="server"
                                    BodyStyle="padding: 6px;" Layout="Fit">
                                    <Items>
                                        <ext:TextArea ID="fieldNote" DataIndex="Note" FieldLabel="label"
                                            runat="server" AnchorHorizontal="100%">
                                        </ext:TextArea>
                                    </Items>
                                </ext:Panel>
    </ext:TabPanel>
    </Items>
    </ext :FormPanel>
       </Items>
    </ext:Viewport
    Romuald
  8. #8
    Hi,

    I cannot reproduce the issue.

    Can you modify my sample to demonstrate the problem?

Similar Threads

  1. Check Panel Form Validation ?
    By Mohammad in forum 1.x Help
    Replies: 0
    Last Post: Nov 29, 2011, 5:46 AM
  2. [CLOSED] How to get all dirty record from a gridpanel
    By xian.xu in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 26, 2011, 12:21 AM
  3. How to set Grid record dirty?
    By speddi in forum 1.x Help
    Replies: 0
    Last Post: Jul 16, 2010, 8:47 PM
  4. Replies: 2
    Last Post: Mar 21, 2010, 1:18 PM
  5. How to check if Form or Editable Grid is Dirty ?
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 1
    Last Post: Aug 31, 2009, 5:03 PM

Posting Permissions