Confirmation with save button

  1. #1

    Confirmation with save button

    Hi,

    I am using below code.
    Now my problem is that, the confirmation box appears before the messagebox in Save(Directevent).
    If the IsFieldEmpty() return false then the messagebox (X.MessageBox.Alert("Error", "Please check all fields").Show();) should appear first and then confirmation box should appear but if I am using below code then confirmation box appears before.

    what I have to do so that confirmationbox appears after?????


      <ext:Window ID="winUsergroup" Hidden="true" runat="server" Collapsible="false" Height="225" 
             Width="350" Resizable="false">
           
            <Items>
                <ext:Panel ID="Panel1" runat="server" Height="300" Title="User Group" Padding="15">
                    <Items>              
                    
                         <ext:TextField ID="txtUserGroupName" runat="server" FieldLabel="User Group"  AllowBlank="false" Width="300" BlankText="Required field" MsgTarget="Side" >
                    
                         </ext:TextField>                     
                        <ext:TextArea ID="txtDescription" runat="server" FieldLabel="Description" Width="300" >
                        </ext:TextArea>
                    </Items>
                </ext:Panel>       
            </Items>
            <Buttons>
                <ext:Button ID="btnSave" runat="server"  Icon="Disk" Text="Save">
                    <DirectEvents>
                        <Click OnEvent="Save">
                            <Confirmation ConfirmRequest="true" Title="Confirm" Message="Are you sure you want to save the record?"/>
                        </Click>      
                    </DirectEvents>
                </ext:Button>
                 <ext:Button ID="btnUpdate" runat="server"  Icon="Disk" Text="Update">
                    <DirectEvents>
                        <Click OnEvent="Update">
                            <Confirmation ConfirmRequest="true" Title="Confirm" Message="Are you sure you want to modify the record?" />
                        </Click>
                    </DirectEvents>
                </ext:Button>
             </Buttons>
        </ext:Window>

     private Boolean IsFieldEmpty()
            {
                if (txtUserGroupName.Text.Trim() == "")
                    return false;
                else
                    return true;
            }
     protected void Save(object sender, DirectEventArgs e)
            {
                if (IsFieldEmpty() == true)
                {
                    AssignData(objusergrp);
                    objusergrp.Insert();
                    this.winUsergroup.Hide();
                    BindGrid();
                    lblMessage.Text = "Record saved Successfully...";
                }
                else
                    X.MessageBox.Alert("Error", "Please check all fields").Show();
            }

    Vaishali Khatri
  2. #2
    Hi

    you need to write a listner for it

    <Listner>
    <Click handler="return isFieldempty()">

    </Click>
    </Listner>

    if the above code will return true then it will go to direct event else it will not

Similar Threads

  1. Confirmation for save button
    By Vaishali in forum 1.x Help
    Replies: 0
    Last Post: Feb 13, 2012, 4:22 AM
  2. how run loadmask after confirmation button?
    By danilo in forum 1.x Help
    Replies: 2
    Last Post: Feb 08, 2012, 10:02 AM
  3. Button postback with confirmation
    By zach in forum Examples and Extras
    Replies: 2
    Last Post: Sep 28, 2011, 3:53 PM
  4. confirmation window default button
    By [WP]joju in forum 1.x Help
    Replies: 0
    Last Post: Aug 13, 2009, 5:02 AM
  5. Button with Confirmation Delete...
    By Maia in forum 1.x Help
    Replies: 16
    Last Post: Mar 11, 2009, 9:59 AM

Posting Permissions