[CLOSED] Reset all fields in a panel

  1. #1

    [CLOSED] Reset all fields in a panel

    Hi,

    I want to reset all fields in a panel.
    To achieve this, I put the panel in a formPanel and I use the formPanel.getForm().reset() method.

    This method works good in some cases, and does not work in other cases.

    One of these cases is the following:
      <ext:FormPanel ID="formPanel3" Border="false" runat="server" Height="250" AnchorHorizontal="100%">
                    <Content>
                        <ext:FieldSet Height="240" runat="server" Title="Current Address Information" Padding="10"
                            ID="fielaSetAddress" AnchorHorizontal="100" ButtonAlign="Right">
                            <Content>
                                <ext:Panel ID="panelAddressTopPanel" runat="server" Border="false">
                                    <Content>
                                        <ext:TableLayout ID="TableLayout11" runat="server" Columns="4">
                                            <Cells>
                                                <ext:Cell CellCls="styleOfTopTable">
                                                    <ext:DateField ID="DateFieldDateFrom" runat="server" FieldLabel="Date from*" Width="250"
                                                        LabelAlign="Right" LabelSeparator=" " AllowBlank="false">
                                                        <Listeners>
                                                            <Select Handler="dateOfBirth.setMaxValue(this.getValue());" />
                                                        </Listeners>
                                                    </ext:DateField>
                                                </ext:Cell>
                                           <ext:Cell CellCls="styleOfTopTable">
                                                    <ext:Button ID="btnResetCurrentAddress" Hidden="true" runat="server" Text="Reset current address"
                                                        Icon="ArrowRefresh">
                                                        <Listeners>
                                                            <Click Handler="formPanel3.getForm().reset(); this.hide(); btnAddMoreAddress.hide(); #                               {DirectMethods}.ResetCurrentAddress();" />
                                                        </Listeners>
                                                    </ext:Button>
                                                </ext:Cell>
                                                 </Cells>
                                        </ext:TableLayout>
                                    </Content>
                                </ext:Panel>
    <ext:Panel ID="panelAddressLowPanel" runat="server" Border="false">
                                    <Content>
                                        <ext:TableLayout ID="TableLayout2" Columns="3" runat="server">
                                            <Cells>
                                                <ext:Cell CellCls="styleOfCells">
                                                    <ext:ComboBox LabelSeparator=" " LabelAlign="Right" ID="comboBoxCountryAddress" runat="server"
                                                        StoreID="dsCountryAddress" Width="250" Editable="true" DisplayField="getCountryName"
                                                        FieldLabel="Country*" AllowBlank="false" ValueField="getId" TypeAhead="true"
                                                        Mode="Local" ForceSelection="true" TriggerAction="All" EmptyText="Select a country..."
                                                        ItemSelector="div.list-item" SelectOnFocus="false" LazyInit="false">
                                                        <Template ID="TemplateCountryAddress" runat="server">
                                                            <Html>
                                                                <tpl for=".">
                                                                        <div class="list-item">
                                                                                <h3>{getCountryName}</h3>
                                                                                {getCcFips}, {getCcIso}
                                                                        </div>
                                                                    </tpl>
                                                            </Html>
                                                        </Template>
                                                        <Listeners>
                                                            <Select Handler=" #{DirectMethods}.LoadCitiesStoreAddress(); txtOtherCityAddress.disable(); txtOtherCityAddress.setValue(' ');  txtOtherCityAddress.allowBlank = true; txtOtherCityAddress.label.update('Other city'); comboBoxCityAddress.allowBlank=false; comboBoxCityAddress.label.update('City*'); comboBoxCityAddress.clearValue(); " />
                                                        </Listeners>
                                                    </ext:ComboBox>
                                                </ext:Cell>
                                                <ext:Cell CellCls="styleOfCells">
                                                    <ext:TextField LabelSeparator=" " Width="250" LabelAlign="Right" ID="txtZipPostalCode"
                                                        runat="server" FieldLabel="ZIP/Postal Code" />
                                                </ext:Cell>
    <ext:Cell CellCls="styleOfCells">
                                                    <ext:SpinnerField LabelSeparator=" " LabelAlign="Right" ID="txtFloor" Width="150"
                                                        Text="0" runat="server" FieldLabel="Floor" MinValue="-5" MaxValue="500" />
                                                </ext:Cell>
                                            </Cells>
                                        </ext:TableLayout>
                                    </Content>
                                </ext:Panel>
                            </Content>
                        </ext:FieldSet>
                    </Content>
                </ext:FormPanel>
    I have two questions:
    1- What is the problem?
    2- Can I use the .getForm().reset() directly to a panel without placing the panel into a formPanel?

    Thanks in advance for your help
    Last edited by Daniil; Aug 28, 2012 at 5:18 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Quote Originally Posted by FpNetWorth View Post
    1- What is the problem?
    It works with items only. Please replace <Content> with <Items> where possible.

    Quote Originally Posted by FpNetWorth View Post
    2- Can I use the .getForm().reset() directly to a panel without placing the panel into a formPanel?
    No, it is the BasicForm functionality.

    But you can cascade all Panel items and call the reset method for all fields.
    http://docs.sencha.com/ext-js/3-4/#!/api/Ext.Container-method-cascade

Similar Threads

  1. [CLOSED] How to reset panel when autoloading a partialview
    By jlosi in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 09, 2012, 4:41 PM
  2. [CLOSED] Dynamic Fields and Collapsed Panel
    By trezv in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 31, 2012, 2:11 PM
  3. How to validate fields of panel
    By hasan in forum 1.x Help
    Replies: 3
    Last Post: Oct 26, 2011, 1:17 PM
  4. Replies: 1
    Last Post: Nov 08, 2010, 9:31 PM
  5. Reset all fields
    By james.healey in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 11, 2009, 12:14 PM

Tags for this Thread

Posting Permissions