[CLOSED] Save FormPanel fields after Confirm Message

  1. #1

    [CLOSED] Save FormPanel fields after Confirm Message

    Hi, All

    We are facing a problem with storing data on backend from a fompanel. We want to save form fields values to database but after confirmation message and also how to deal with comboboxes values in FormPanel. (Ext.Net 1.3)
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    
    </head>
    <body>
        <form runat="server" >
        <ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="TiersAjax">
        </ext:ResourceManager>
       
        <ext:Store ID="StoreCountry" runat="server">
            <Reader>
                <ext:JsonReader IDProperty="Country_ID">
                    <Fields>
                        <ext:RecordField Name="Country_ID" />
                        <ext:RecordField Name="Country_Name_En" />
                        <ext:RecordField Name="Country_Name" />
                        <ext:RecordField Name="Country_Name_Ar" />
                        <ext:RecordField Name="Ordering" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>    
        <ext:Store ID="StoreUnits" runat="server">
            <Reader>
                <ext:JsonReader IDProperty="Unit_ID">
                    <Fields>
                        <ext:RecordField Name="Unit_ID" />
                        <ext:RecordField Name="Unit_En" />
                        <ext:RecordField Name="Unit_Ar" />
                        <ext:RecordField Name="Unit" />
                    </Fields>
                </ext:JsonReader>
            </Reader>        
        </ext:Store>
        <ext:Viewport ID="Viewport1" runat="server" Layout="border">
            <Items>
                <ext:Window ID="wdwAddStudents" runat="server" Hidden="false" Collapsible="false"
                    Header="false" Height="305" Icon="ChartOrganisation" Title="Add Student" 
                    Layout="FitLayout" PreventBodyReset="true" Width="590" Maximizable="false" AutoScroll="true" AutoDestroy="true"
                    ButtonAlign="Center" Region="Center" Closable="false">
                    <Items>                    
                        <ext:FormPanel ID="FormPanel2" LabelWidth="150" AutoScroll="true" runat="server"
                            ButtonAlign="Center" Frame="true" Layout="Form" Padding="5" >
                                    <Items>
                                        <ext:NumberField ID="nbfStudent_ID" DataIndex="Student_ID" MaxLength="9" FieldLabel="Student_ID"
                                            runat="server" AllowBlank="false" Width="150" AnchorHorizontal="25%">
                                        </ext:NumberField>
                                        <ext:CompositeField ID="cpfNameArabic" runat="server" NoteAlign="Top" AutoScroll="true"
                                            LabelAlign="Left" FieldLabel="<%$ Resources:ParadigmMres, Name_Ar%>" AnchorHorizontal="60%">
                                            <Items>
                                                <ext:TextField ID="txfStudent_Name_Ar_3" DataIndex="Student_Name_Ar_3" Flex="1" 
                                                    runat="server" AllowBlank="false">
                                                </ext:TextField>
                                                <ext:TextField ID="txfStudent_Name_Ar_2" DataIndex="Student_Name_Ar_2" Flex="1"           
                                                   runat="server" AllowBlank="false">
                                                </ext:TextField>
                                                <ext:TextField ID="txfStudent_Name_Ar_1" DataIndex="Student_Name_Ar_1" Flex="1" 
                                                    runat="server" AllowBlank="false">
                                                </ext:TextField>
                                            </Items>
                                        </ext:CompositeField>
                                        
                                        <ext:TextField ID="txfProfession_Ar" runat="server" FieldLabel="Profession (Ar)" 
                                                       AllowBlank="false" AnchorHorizontal="45%">
                                        </ext:TextField>
                                        <ext:ComboBox ID="cbxNationality_ID" DataIndex="Nationality_ID" FieldLabel="Nationality"
                                            runat="server" AnchorHorizontal="35%" StoreID="StoreCountry" ValueField="Country_ID"
                                            DisplayField="Country_Name" AllowBlank="false" Editable="false">
                                            <SelectedItem Value="213" />
                                        </ext:ComboBox>                                    
                                        <ext:CompositeField ID="cpfNameEnglish" runat="server" NoteAlign="Top" AutoScroll="true"
                                            AnchorHorizontal="60%" LabelAlign="Left" FieldLabel="<%$ Resources:ParadigmMres, Name_En%>">
                                            <Items>
                                                <ext:TextField ID="txfStudent_Name_En_1" DataIndex="Student_Name_En_1" Flex="1" 
                                                    runat="server" AllowBlank="true">
                                                </ext:TextField>
                                                <ext:TextField ID="txfStudent_Name_En_2" DataIndex="Student_Name_En_2" Flex="1" 
                                                    runat="server" AllowBlank="true">
                                                </ext:TextField>
                                                <ext:TextField ID="txfStudent_Name_En_3" DataIndex="Student_Name_En_3" Flex="1" 
                                                    runat="server" AllowBlank="true">
                                                </ext:TextField>
                                            </Items>
                                        </ext:CompositeField>
                                        
                                        <ext:TextField ID="txfProfession_En" runat="server"  FieldLabel="Profession (En)%>" 
                                                        AllowBlank="true" AnchorHorizontal="40%">
                                        </ext:TextField>
                                        <ext:ComboBox ID="cbxUnit_ID" DataIndex="Unit_ID" FieldLabel="Unit"
                                            runat="server" AnchorHorizontal="35%" StoreID="StoreUnits" ValueField="Unit_ID" Editable="false"
                                            DisplayField="Unit" AllowBlank="false" >
                                        </ext:ComboBox>
                                   
                            </Items>
                            <Buttons>
                                <ext:Button runat="server" ID="Button2" Icon="Disk" Text="Save">
                                    <DirectEvents>
                                        <Click Before="return #{FormPanel2}.getForm().isValid();" OnEvent="saveStudent" >
                                            <ExtraParams>
                                                <ext:Parameter Mode="Raw" Name="FormValues" Value="Ext.encode(#{FormPanel2}.getForm().getValues())" />
                                            </ExtraParams>
                                        </Click>
                                    </DirectEvents>                                
                                </ext:Button>
                            </Buttons>
                        </ext:FormPanel>
                    </Items>                
                </ext:Window>
            </Items>
        </ext:Viewport>
    
        </form>
    </body>
    </html>
    the code for save form :
    protected void saveStudent(object sender, DirectEventArgs e)
            {
               //used for confirmation  when clicking on "Yes" button the directMethod DoYes() is fired
                UtilityHelper.ConfirmDisplayMsg(ParadigmMres.msgConfirmTitle, ParadigmMres.msgConfimStudentAdd);
                //Public static string
                formValues = e.ExtraParams["FormValues"];
            }
    
    
    [DirectMethod]
            public void DoYes()
            {
                string student_ID = nbfStudent_ID.Text;
                string nationality_ID = cbxNationality_ID.SelectedItem.Value;
                
               // After succesful retrieving we will update DB and reset the formPanel
    
            }
    
     [DirectMethod]
            public void DoNo()
            {
    
            }
    All the fields values from the formPanel are null. (but without ConfirmMessage It's ok).

    Di you have any suggestions to retrieve fields values ?
    Last edited by Daniil; May 10, 2012 at 8:24 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Please use the built-in DirectEvent feature to confirm a request.

    Please click the second button here:
    https://examples1.ext.net/#/Events/D...ents/Overview/

    Example
    <ext:Button ID="Button4" runat="server" Text="Click Me">
        <DirectEvents>
            <Click OnEvent="UpdateTimeStamp">
                <Confirmation ConfirmRequest="true" Title="Title" Message="Sample Confirmation Message..." />
            </Click>
        </DirectEvents>
    </ext:Button>
    how to deal with comboboxes values in FormPanel
    Please provide more details about the problem.

    I guess you just should use the getFieldsValues method instead of the getValues one.
    http://docs.sencha.com/ext-js/3-4/#!...getFieldValues
    http://docs.sencha.com/ext-js/3-4/#!...thod-getValues
  3. #3
    Thanks Daniil

    It works fine now.

    Please mark as CLOSED.

Similar Threads

  1. confirm message box problem
    By mehmood in forum 1.x Help
    Replies: 6
    Last Post: Jun 21, 2012, 1:47 PM
  2. Confirm message handler
    By norphos in forum 1.x Help
    Replies: 1
    Last Post: May 18, 2011, 6:51 AM
  3. [CLOSED] Message box confirm dialogue handling
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Aug 07, 2009, 1:37 AM
  4. [CLOSED] confirm message problem
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 12, 2009, 5:43 AM
  5. Ext confirm message
    By methode in forum Feature Requests
    Replies: 4
    Last Post: Nov 20, 2008, 1:02 PM

Tags for this Thread

Posting Permissions