How to know which field in the formpanel is inValid?

  1. #1

    How to know which field in the formpanel is inValid?

    Hi

    How to know which field in the formpanel is inValid?
    I have a code as

    <ext:Button ID="btnUpdate" runat="server" Icon="Disk" Text="Update">
                                            <DirectEvents>
                                                <Click OnEvent="Update" Before="if(!#{frmUserManager}.getForm().isValid()) return false;">
                                                    
                                                    <Confirmation ConfirmRequest="true" Title="Confirm" Message="Are you sure you want to modify the information?"/>
                                                     <EventMask ShowMask="true" Msg="Updating record..." MinDelay="10" />
                                                </Click>
                                            </DirectEvents>
                                        </ext:Button>
    I have Used in all the fields

    AllowBlank="false" BlankText="Enter Mobile no." MsgTarget="Side"

    When I save the record record is save i.e !#{frmUserManager}.getForm().isValid() returns true.
    But when I update the the record it returns false... I havent seen any red lines.
    So I want to know which field is invalid.


    I also have used
     <ext:TextField ID="txtUsername" runat="server" Width="255" FieldLabel="Username"
                                    X="20" Y="50" MaskRe="[a-zA-Z0-9]" AllowBlank="false" BlankText="Enter Username"
                                    MsgTarget="Side" IsRemoteValidation="true">
                                        <RemoteValidation OnValidation="CheckUserName" />    
                                    </ext:TextField>
                                    <ext:TextField ID="txtPassword" runat="server" Width="255" FieldLabel="Password"              
                                                MinLength="8" Vtype="password"
                                                InputType="Password" AllowBlank="false" BlankText="Enter Password"
                                                MsgTarget="Side"
                                                X="20" Y="75" />
                                    <ext:TextField ID="txtConfirm" runat="server" Width="255" FieldLabel="Confirm Password"
                                                X="20" Y="100" Vtype="password"             
                                                MinLength="8" AllowBlank="false" BlankText="Enter Password"
                                                MsgTarget="Side"
                                                InputType="Password" IsRemoteValidation="true">
                                                <RemoteValidation OnValidation="CheckPassword"></RemoteValidation>
                                </ext:TextField>
    When I want to update the record this fields are disabled
    Is it because of this the #{frmUserManager}.getForm().isValid() returns false???????????


    Vaishali Khatri
    Kintu Designs PVT LTD
    Last edited by Vaishali; Feb 27, 2012 at 8:16 AM.
  2. #2
    I got why the form return invalid
    Its because of remote validation?


    Now how the when I click on update the field is disabled
    So what I have to write?
  3. #3
    Hi vaishali

    Just send me your frmUserManager panel code
  4. #4
     <ext:Window ID="winUserManager" runat="server" Height="454" 
            Width="644" Hidden="true" Resizable="false" InitCenter="true" >
            <Items>     
                <ext:TabPanel ID="tabPanelUserManager" runat="server" Height="422" Title="User Group"  Width="630" Frame="true" >
                    <Items>
                        <ext:FormPanel ID="frmUserManager" runat="server" Title="User Details" Border="false" Padding="20"  Height="422"  Margins="20" Layout="AbsoluteLayout">
                            <Items>
                       
                          
                                 <ext:ComboBox ID="cmbUserGroup" runat="server" FieldLabel="User Group" 
                                    EmptyText="Select User group" Width="255" AllowBlank="false" 
                                    MsgTarget="Side" StoreID="UserGroupStore" BlankText="Please select Usergroup"
                                    DisplayField="UserGroupName" ValueField="UserGroupId"  X="20" Y="25">                   
                                </ext:ComboBox>
                                  <ext:TextField ID="txtUsername" runat="server" Width="255" FieldLabel="Username"
                                    X="20" Y="50" MaskRe="[a-zA-Z0-9]" AllowBlank="false" BlankText="Enter Username"
                                    MsgTarget="Side" IsRemoteValidation="true">
                                        <RemoteValidation OnValidation="CheckUserName" />    
                                    </ext:TextField>
                                    <ext:TextField ID="txtPassword" runat="server" Width="255" FieldLabel="Password"              
                                                MinLength="8" Vtype="password"
                                                InputType="Password" AllowBlank="false" BlankText="Enter Password"
                                                MsgTarget="Side"
                                                X="20" Y="75" />
                                    <ext:TextField ID="txtConfirm" runat="server" Width="255" FieldLabel="Confirm Password"
                                                X="20" Y="100" Vtype="password"             
                                                MinLength="8" AllowBlank="false" BlankText="Enter Password"
                                                MsgTarget="Side"
                                                InputType="Password" IsRemoteValidation="true">
                                                <RemoteValidation OnValidation="CheckPassword" Single="true"></RemoteValidation>
                                </ext:TextField>
                               
                                <ext:CompositeField ID="CompositeField1" runat="server" FieldLabel="Full name" X="20" y="135">
                                    <Items>
                                        <ext:TextField ID="txtFirstname" runat="server" Width="150" EmptyText="First name"
                                           AllowBlank="false" BlankText="Enter Firstname"
                                           MsgTarget="Side" MaskRe="[a-zA-Z]"/>
                                        <ext:TextField ID="txtMiddlename" runat="server" Width="150" EmptyText="Middle name"
                                            MaskRe="[a-zA-Z]"/>
                                        <ext:TextField ID="txtLastname" runat="server" Width="150" EmptyText="Last name"
                                           AllowBlank="false" BlankText="Enter Lastname"
                                           MsgTarget="Side" MaskRe="[a-zA-Z]"/>
                                    </Items>
                                </ext:CompositeField>
                                
                                 <ext:TextField ID="txtEmail" runat="server" Width="565" FieldLabel="Email" X="20"
                                    Y="160"  Vtype="email"  AllowBlank="false" BlankText="Enter Emailid"
                                           MsgTarget="Side"/>  
                                
                                  <ext:RadioGroup ID="rdogrpGender" runat="server"  X="20" Y="185"
                                            FieldLabel="Gender"  ColumnsWidths="80,80">
                                            <Items>
                                                <ext:Radio ID="rdoMale" runat="server" BoxLabel="Male" InputValue="true">
                                                </ext:Radio>
                                                <ext:Radio ID="rdoFemale" runat="server" BoxLabel="Female" InputValue="false" >
                                                </ext:Radio>
                                            </Items>
                                        </ext:RadioGroup>
                                 
                                 <ext:DateField ID="dtDob" runat="server" Width="255" 
                                    FieldLabel="Date of Birth" X="20" Y="210"
                                    AllowBlank="false" BlankText="Enter Date of Birth"
                                           MsgTarget="Side">
                                </ext:DateField>
                                
                                <ext:TextField ID="txtExp" runat="server" FieldLabel="Experience(yrs.)" X="330" Y="185"
                                    Width="255" MaskRe="[0-9]"  AllowBlank="false" BlankText="Enter year of experience"
                                           MsgTarget="Side"/>  
                                    <ext:DateField ID="dtDoj" runat="server" FieldLabel="Date Of Joining" X="330" Y="210"
                                    Width="255" 
                                           />
                                
                                  <ext:FieldSet ID="FieldSet3" runat="server" Title="Address" X="12" Y="245" Width="300" BodyBorder="false" Padding="5">
                                    <Items>
                                        <ext:TextArea ID="txtAddress" runat="server" FieldLabel="Address" Width="250" 
                                            AllowBlank="false" BlankText="Enter Address"
                                           MsgTarget="Side">
                                        </ext:TextArea>
                                        <ext:ComboBox ID="cmbCity" FieldLabel="City" runat="server" Width="250" EmptyText="Select City"
                                        StoreID="CityStore" DisplayField="CityName" ValueField="CityId"
                                        AllowBlank="false" BlankText="Please select city"
                                           MsgTarget="Side">
                                        </ext:ComboBox>
                                       
                                    </Items>
                                </ext:FieldSet>
                               <ext:FieldSet ID="FieldSet1" runat="server" Title="Primary Contacts" X="330" Y="245" Width="300" BodyBorder="false" Padding="5">
                                    <Items>
                                        <ext:TextField ID="txtResidence" runat="server" MaskRe="[0-9-]"
                                         Truncate="false" FieldLabel="Residence" X="-10" Width="240"
                                         AllowBlank="false" BlankText="Enter contact no."
                                           MsgTarget="Side" MinLength="5"/>
                                        <ext:TextField ID="txtMobile" MaskRe="[0-9]" MinLength="10" 
                                        Truncate="false" runat="server" FieldLabel="Mobile" X="-10" 
                                        Width="240" AllowBlank="false" BlankText="Enter Mobile no."
                                           MsgTarget="Side" />
                                    </Items>
                                </ext:FieldSet>
                           
                          
                            </Items> 
                            <BottomBar>
                                <ext:Toolbar runat="server" Flat="false">
                                    <Items>
                                        <ext:ToolbarFill runat="server" Width="200"></ext:ToolbarFill>
                                        <ext:Button ID="btnSave" runat="server"  Icon="Disk" Text="Save">
                                          <%--  <Listeners>
                                                <Click handler="if(frmUserManager.isValid()==false){alert('Data is not correct');return false;}else{return true;}" />
                                             </Listeners>--%>
                                            <DirectEvents>
                                                <Click OnEvent="Save" Before="if(!#{frmUserManager}.getForm().isValid()) return false;">
                                                    <Confirmation ConfirmRequest="true" Title="Confirm" Message="Are you sure you want to save the information?"/>
                                                     <EventMask ShowMask="true" Msg="Saving record..." MinDelay="10" />
                                                </Click>
                                            </DirectEvents>
                                        </ext:Button>
                                        <ext:Button ID="btnUpdate" runat="server" Icon="Disk" Text="Update">
                                            <DirectEvents>
                                                <Click OnEvent="Update" Before="if(!#{frmUserManager}.getForm().isValid()) return false;">
                                                    
                                                    <Confirmation ConfirmRequest="true" Title="Confirm" Message="Are you sure you want to modify the information?"/>
                                                     <EventMask ShowMask="true" Msg="Updating record..." MinDelay="10" />
                                                </Click>
                                            </DirectEvents>
                                        </ext:Button>      
                                    </Items>
                                </ext:Toolbar>                        
                            </BottomBar>              
                          
                            </ext:FormPanel> 
                            
                           
                        
                         <ext:Panel ID="Panel3" runat="server" Title="User Service" Border="false" Padding="10" Width="624" Height="452"  Margins="20">
                            <TopBar>
                                <ext:Toolbar ID="Toolbar2" runat="server">
                                    <Items>
                                     <ext:ComboBox 
                                        ID="cmbUser" 
                                        runat="server"
                                        EmptyText="Select User"
                                        TypeAhead="true"
                                        ForceSelection="true"
                                        StoreID="UserStore"
                                        Mode="Local"
                                        DisplayField="UserName" 
                                        ValueField="UserId"
                                        MinChars="1"
                                        ListWidth="300"
                                        PageSize="10"
                                        ItemSelector="tr.list-item">
                                        <Template ID="Template1" runat="server">
                                            <Html>
    					                        <tpl for=".">
    						                        <tpl if="[xindex] == 1">
    							                        <table class="cmbUser-list">
    								                        <tr>
    									                        <th>UserName</th>
    									                        <th>UserGroup</th>
    								                        </tr>
    						                        </tpl>
    						                        <tr class="list-item">
    							                        <td style="padding:3px 0px;">{UserName}</td>
    							                        <td>{UserGroupName}</td>
    						                        </tr>
    						                        <tpl if="[xcount-xindex]==0">
    							                        </table>
    						                        </tpl>
    					                        </tpl>
    				                        </Html>
                                        </Template>
                                         <DirectEvents>
                                            <Select OnEvent="Change">  
                                                <EventMask ShowMask="true"/>
                                                <ExtraParams>
                                                    <ext:Parameter Name="id" Value="record.id"  />
                                                </ExtraParams>
                                            </Select>
                                        </DirectEvents>
                                        </ext:ComboBox>
                                                          
                                        <ext:ToolbarFill></ext:ToolbarFill> 
                                        <ext:Button ID="btnSaveService" runat="server" Text="Save" Icon="Disk">
                                          <DirectEvents>
                                            <Click OnEvent="SaveUserService">
                                                <Confirmation ConfirmRequest="true" Title="Confirm" Message="Are you sure you want to save the information?"/>
                                                <EventMask ShowMask="true" Msg="Saving record..." MinDelay="10" />
                                                <ExtraParams>
                                                    <ext:Parameter
                                                        Name="values"
                                                        Value="GridPanel3.getRowsValues()"
                                                        Mode="Raw"
                                                        Encode="true" />
                                                </ExtraParams>
                                            </Click>
                                        </DirectEvents>
                                          
                                        </ext:Button>
                                        <ext:ToolbarSeparator runat="server"></ext:ToolbarSeparator>
                                        <ext:Button ID="btnUpdateService" runat="server"  Icon="Disk" Text="Update">
                                            <DirectEvents>
                                            <Click OnEvent="UpdateUserService">
                                                <Confirmation ConfirmRequest="true" Title="Confirm" Message="Are you sure you want to modify the information?"/>
                                                <EventMask ShowMask="true" Msg="Updating record..." MinDelay="500" />
                                                <ExtraParams>
                                                    <ext:Parameter
                                                        Name="values"
                                                        Value="GridPanel3.getRowsValues()"
                                                        Mode="Raw"
                                                        Encode="true" />
                                                </ExtraParams>
                                            </Click>
                                        </DirectEvents>
                                        </ext:Button>       
                                    </Items>
                                </ext:Toolbar>
                            </TopBar>
                            <Items>
                                 <ext:ColumnLayout ID="ColumnLayout1" runat="server" FitHeight="true">
                                    <Columns>
                                        <ext:LayoutColumn ColumnWidth="0.5">
                                             <ext:GridPanel 
                                                runat="server" 
                                                ID="GridPanel2" 
                                                AutoExpandColumn="ServiceName"
                                                StoreID="ServiceStore" >
                                                    <ColumnModel ID="ColumnModel2" runat="server">
    	                                                <Columns>
                                                            <ext:Column ColumnID="Service" Header="Available Service" DataIndex="ServiceName" />                   
    	                                                </Columns>
                                                    </ColumnModel>
                                                    <SelectionModel>
                                                        <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
                                                    </SelectionModel> 
                                                    <Plugins>
                                                        <ext:GridFilters ID="GridFilters1" runat="server" Local="true">
                                                        <Filters>
                                                            <ext:StringFilter DataIndex="ServiceName" />
                                                        </Filters>
                                                        </ext:GridFilters>
                                                    </Plugins>
                                                </ext:GridPanel>
                                        </ext:LayoutColumn>
                                        <ext:LayoutColumn>
                                <ext:Panel ID="Panel5" runat="server" Width="35" BodyStyle="background-color: transparent;" Border="false" Layout="Anchor">
                                    <Items>
                                        <ext:Panel ID="Panel6" runat="server" Border="false" BodyStyle="background-color: transparent;" AnchorVertical="40%" AnchorHorizontal="100%"/>
                                        <ext:Panel ID="Panel7" runat="server" Border="false" BodyStyle="background-color: transparent;" Padding="5">
                                            <Items>
                                                <ext:Button ID="Button4" runat="server" Icon="ResultsetNext" StyleSpec="margin-bottom:2px;">
                                                    <Listeners>
                                                        <Click Handler="ServiceSelector.add();" />
                                                    </Listeners>
                                                    <ToolTips>
                                                        <ext:ToolTip ID="ToolTip1" runat="server" Title="Add" Html="Add Selected Rows" />
                                                    </ToolTips>
                                                </ext:Button>
                                               <%-- <ext:Button ID="Button5" runat="server" Icon="ResultsetLast" StyleSpec="margin-bottom:2px;">
                                                    <Listeners>
                                                        <Click Handler="ServiceSelector.addAll();" />
                                                    </Listeners>
                                                    <ToolTips>
                                                        <ext:ToolTip ID="ToolTip2" runat="server" Title="Add all" Html="Add All Rows" />
                                                    </ToolTips>
                                                </ext:Button>--%>
                                                <ext:Button ID="Button6" runat="server" Icon="ResultsetPrevious" StyleSpec="margin-bottom:2px;">
                                                    <Listeners>
                                                        <Click Handler="ServiceSelector.remove(GridPanel2, GridPanel3);" />
                                                    </Listeners>
                                                    <ToolTips>
                                                        <ext:ToolTip ID="ToolTip3" runat="server" Title="Remove" Html="Remove Selected Rows" />
                                                    </ToolTips>
                                                </ext:Button>
                                               <%-- <ext:Button ID="Button7" runat="server" Icon="ResultsetFirst" StyleSpec="margin-bottom:2px;">
                                                    <Listeners>
                                                        <Click Handler="ServiceSelector.removeAll(GridPanel1, GridPanel2);" />
                                                    </Listeners>
                                                    <ToolTips>
                                                        <ext:ToolTip ID="ToolTip4" runat="server" Title="Remove all" Html="Remove All Rows" />
                                                    </ToolTips>
                                                </ext:Button>--%>
                                            </Items>
                                        </ext:Panel>
                                    </Items>
                                </ext:Panel>
                            </ext:LayoutColumn>
                                         <ext:LayoutColumn ColumnWidth="0.5">
                                            <ext:GridPanel 
                                                runat="server" 
                                                ID="GridPanel3" 
                                                EnableDragDrop="false"
                                                AutoExpandColumn="ServiceName" 
                                                StoreID="SelectedStore">
                                                    <Listeners>
                                                    </Listeners>
                                                    <ColumnModel ID="ColumnModel3" runat="server">
    	                                                <Columns>
                                                            <ext:Column ColumnID="Country" Header="Selected Service" DataIndex="ServiceName" />                   
    	                                                </Columns>
                                                    </ColumnModel>
                                                    <SelectionModel>
                                                        <ext:RowSelectionModel ID="RowSelectionModel2" runat="server" />
                                                    </SelectionModel>  
                                                    <%--<SaveMask ShowMask="true" />--%>
                                            </ext:GridPanel>
                                        </ext:LayoutColumn>
                                    </Columns>
                                  </ext:ColumnLayout>                             
                            </Items>
                            
                        </ext:Panel>                        
                    </Items>    
                </ext:TabPanel>
            </Items>    
           
        </ext:Window>
  5. #5
    Hi vaishali

    use the below code

    
    <ext:Window ID="winUserManager" runat="server" Height="454" Width="644" Hidden="true"
            Resizable="false" InitCenter="true">
            <Items>
                <ext:TabPanel ID="tabPanelUserManager" runat="server" Height="422" Title="User Group"
                    Width="630" Frame="true">
                    <Items>
                        <ext:FormPanel ID="frmUserManager" AutoScroll="true" runat="server" Title="User Details"
                            Border="false" Padding="20" Height="422" Margins="20" Layout="AbsoluteLayout">
                            <Items>
                                <ext:ComboBox ID="cmbUserGroup" runat="server" FieldLabel="User Group" EmptyText="Select User group"
                                    Width="255" AllowBlank="false" MsgTarget="Side" StoreID="UserGroupStore" BlankText="Please select Usergroup"
                                    DisplayField="UserGroupName" ValueField="UserGroupId" X="20" Y="25">
                                    <Items>
                                        <ext:ListItem Text="Surat" Value="Surat" />
                                    </Items>
                                </ext:ComboBox>
                                <ext:TextField ID="txtUsername" runat="server" Width="255" FieldLabel="Username"
                                    X="20" Y="50" MaskRe="[a-zA-Z0-9]" AllowBlank="false" BlankText="Enter Username"
                                    MsgTarget="Side" IsRemoteValidation="false">
                                    <%--  <RemoteValidation OnValidation="CheckUserName" />--%>
                                </ext:TextField>
                                <ext:TextField ID="txtPassword" runat="server" Width="255" FieldLabel="Password"
                                    MinLength="8" Vtype="password" InputType="Password" AllowBlank="false" BlankText="Enter Password"
                                    MsgTarget="Side" X="20" Y="75" />
                                <ext:TextField ID="txtConfirm" runat="server" Width="255" FieldLabel="Confirm Password"
                                    X="20" Y="100" Vtype="password" MinLength="8" AllowBlank="false" BlankText="Enter Password"
                                    MsgTarget="Side" InputType="Password" IsRemoteValidation="false">
                                    <%-- <RemoteValidation OnValidation="CheckPassword" Single="true">
                                    </RemoteValidation>--%>
                                </ext:TextField>
                                <ext:CompositeField ID="CompositeField1" runat="server" FieldLabel="Full name" X="20"
                                    Y="135">
                                    <Items>
                                        <ext:TextField ID="txtFirstname" runat="server" Width="150" EmptyText="First name"
                                            AllowBlank="false" BlankText="Enter Firstname" MsgTarget="Side" MaskRe="[a-zA-Z]" />
                                        <ext:TextField ID="txtMiddlename" runat="server" Width="150" EmptyText="Middle name"
                                            MaskRe="[a-zA-Z]" />
                                        <ext:TextField ID="txtLastname" runat="server" Width="150" EmptyText="Last name"
                                            AllowBlank="false" BlankText="Enter Lastname" MsgTarget="Side" MaskRe="[a-zA-Z]" />
                                    </Items>
                                </ext:CompositeField>
                                <ext:TextField ID="txtEmail" runat="server" Width="565" FieldLabel="Email" X="20"
                                    Y="160" Vtype="email" AllowBlank="false" BlankText="Enter Emailid" MsgTarget="Side" />
                                <ext:RadioGroup ID="rdogrpGender" runat="server" X="20" Y="185" FieldLabel="Gender"
                                    ColumnsWidths="80,80">
                                    <Items>
                                        <ext:Radio ID="rdoMale" runat="server" BoxLabel="Male" InputValue="true">
                                        </ext:Radio>
                                        <ext:Radio ID="rdoFemale" runat="server" BoxLabel="Female" InputValue="false">
                                        </ext:Radio>
                                    </Items>
                                </ext:RadioGroup>
                                <ext:DateField ID="dtDob" runat="server" Width="255" FieldLabel="Date of Birth" X="20"
                                    Y="210" AllowBlank="false" BlankText="Enter Date of Birth" MsgTarget="Side">
                                </ext:DateField>
                                <ext:TextField ID="txtExp" runat="server" FieldLabel="Experience(yrs.)" X="330" Y="185"
                                    Width="255" MaskRe="[0-9]" AllowBlank="false" BlankText="Enter year of experience"
                                    MsgTarget="Side" />
                                <ext:DateField ID="dtDoj" runat="server" FieldLabel="Date Of Joining" X="330" Y="210"
                                    Width="255" />
                                <ext:FieldSet ID="FieldSet3" runat="server" Title="Address" X="12" Y="245" Width="300"
                                    BodyBorder="false" Padding="5">
                                    <Items>
                                        <ext:TextArea ID="txtAddress" runat="server" FieldLabel="Address" Width="250" AllowBlank="false"
                                            BlankText="Enter Address" MsgTarget="Side">
                                        </ext:TextArea>
                                        <ext:ComboBox ID="cmbCity" FieldLabel="City" runat="server" Width="250" EmptyText="Select City"
                                            StoreID="CityStore" DisplayField="CityName" ValueField="CityId" AllowBlank="false"
                                            BlankText="Please select city" MsgTarget="Side">
                                            <Items>
                                                <ext:ListItem Text="Surat" Value="Surat" />
                                            </Items>
                                        </ext:ComboBox>
                                    </Items>
                                </ext:FieldSet>
                                <ext:FieldSet ID="FieldSet1" runat="server" Title="Primary Contacts" X="330" Y="245"
                                    Width="300" BodyBorder="false" Padding="5">
                                    <Items>
                                        <ext:TextField ID="txtResidence" runat="server" MaskRe="[0-9-]" Truncate="false"
                                            FieldLabel="Residence" X="-10" Width="240" AllowBlank="false" BlankText="Enter contact no."
                                            MsgTarget="Side" MinLength="5" />
                                        <ext:TextField ID="txtMobile" MaskRe="[0-9]" MinLength="10" Truncate="false" runat="server"
                                            FieldLabel="Mobile" X="-10" Width="240" AllowBlank="false" BlankText="Enter Mobile no."
                                            MsgTarget="Side" />
                                    </Items>
                                </ext:FieldSet>
                            </Items>
                            <BottomBar>
                                <ext:Toolbar ID="Toolbar2" runat="server" Flat="false">
                                    <Items>
                                        <ext:ToolbarFill ID="ToolbarFill2" runat="server" Width="200">
                                        </ext:ToolbarFill>
                                        <ext:Button ID="btnSave" runat="server" Icon="Disk" Text="Save">
                                            <%--  <Listeners>
                                               <Click handler="if(frmUserManager.isValid()==false){alert('Data is not correct');return false;}else{return true;}" />
                                            </Listeners>--%>
                                            <DirectEvents>
                                                <Click OnEvent="Save" Before="if(!#{frmUserManager}.getForm().isValid()) return false;">
                                                    <Confirmation ConfirmRequest="true" Title="Confirm" Message="Are you sure you want to save the information?" />
                                                    <EventMask ShowMask="true" Msg="Saving record..." MinDelay="10" />
                                                </Click>
                                            </DirectEvents>
                                        </ext:Button>
                                        <ext:Button ID="btnUpdate" runat="server" Icon="Disk" Text="Update">
                                            <DirectEvents>
                                                <Click OnEvent="Save" Before="if(!#{frmUserManager}.getForm().isValid()) return false;">
                                                    <Confirmation ConfirmRequest="true" Title="Confirm" Message="Are you sure you want to modify the information?" />
                                                    <EventMask ShowMask="true" Msg="Updating record..." MinDelay="10" />
                                                </Click>
                                            </DirectEvents>
                                        </ext:Button>
                                    </Items>
                                </ext:Toolbar>
                            </BottomBar>
                        </ext:FormPanel>
                        <ext:Panel ID="Panel3" runat="server" Title="User Service" Border="false" Padding="10"
                            Width="624" Height="452" Margins="20">
                            <TopBar>
                                <ext:Toolbar ID="Toolbar3" runat="server">
                                    <Items>
                                        <ext:ComboBox ID="cmbUser" runat="server" EmptyText="Select User" TypeAhead="true"
                                            ForceSelection="true" StoreID="UserStore" Mode="Local" DisplayField="UserName"
                                            ValueField="UserId" MinChars="1" ListWidth="300" PageSize="10" ItemSelector="tr.list-item">
                                            <Template ID="Template1" runat="server">
                                                <Html>
                                                <tpl for=".">
                                                   <tpl if="[xindex] == 1">
                                                       <table class="cmbUser-list">
                                                           <tr>
                                                               <th>UserName</th>
                                                               <th>UserGroup</th>
                                                           </tr>
                                                   </tpl>
                                                   <tr class="list-item">
                                                       <td style="padding:3px 0px;">{UserName}</td>
                                                       <td>{UserGroupName}</td>
                                                   </tr>
                                                   <tpl if="[xcount-xindex]==0">
                                                       </table>
                                                   </tpl>
                                               </tpl>
                                                </Html>
                                            </Template>
                                            <DirectEvents>
                                                <%--<Select OnEvent="Change">
                                                    <EventMask ShowMask="true" />
                                                    <ExtraParams>
                                                        <ext:Parameter Name="id" Value="record.id" />
                                                    </ExtraParams>
                                                </Select>--%>
                                            </DirectEvents>
                                        </ext:ComboBox>
                                        <ext:ToolbarFill>
                                        </ext:ToolbarFill>
                                        <ext:Button ID="btnSaveService" runat="server" Text="Save" Icon="Disk">
                                            <DirectEvents>
                                                <%-- <Click OnEvent="SaveUserService">
                                                    <Confirmation ConfirmRequest="true" Title="Confirm" Message="Are you sure you want to save the information?" />
                                                    <EventMask ShowMask="true" Msg="Saving record..." MinDelay="10" />
                                                    <ExtraParams>
                                                        <ext:Parameter Name="values" Value="GridPanel3.getRowsValues()" Mode="Raw" Encode="true" />
                                                    </ExtraParams>
                                                </Click>--%>
                                            </DirectEvents>
                                        </ext:Button>
                                        <ext:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
                                        </ext:ToolbarSeparator>
                                        <ext:Button ID="btnUpdateService" runat="server" Icon="Disk" Text="Update">
                                            <DirectEvents>
                                                <%-- <Click OnEvent="UpdateUserService">
                                                    <Confirmation ConfirmRequest="true" Title="Confirm" Message="Are you sure you want to modify the information?" />
                                                    <EventMask ShowMask="true" Msg="Updating record..." MinDelay="500" />
                                                    <ExtraParams>
                                                        <ext:Parameter Name="values" Value="GridPanel3.getRowsValues()" Mode="Raw" Encode="true" />
                                                    </ExtraParams>
                                                </Click>--%>
                                            </DirectEvents>
                                        </ext:Button>
                                    </Items>
                                </ext:Toolbar>
                            </TopBar>
                            <Items>
                                <ext:ColumnLayout ID="ColumnLayout1" runat="server" FitHeight="true">
                                    <Columns>
                                        <ext:LayoutColumn ColumnWidth="0.5">
                                            <ext:GridPanel runat="server" ID="GridPanel2" AutoExpandColumn="ServiceName" StoreID="ServiceStore">
                                                <ColumnModel ID="ColumnModel2" runat="server">
                                                    <Columns>
                                                        <ext:Column ColumnID="Service" Header="Available Service" DataIndex="ServiceName" />
                                                    </Columns>
                                                </ColumnModel>
                                                <SelectionModel>
                                                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
                                                </SelectionModel>
                                                <Plugins>
                                                    <ext:GridFilters ID="GridFilters1" runat="server" Local="true">
                                                        <Filters>
                                                            <ext:StringFilter DataIndex="ServiceName" />
                                                        </Filters>
                                                    </ext:GridFilters>
                                                </Plugins>
                                            </ext:GridPanel>
                                        </ext:LayoutColumn>
                                        <ext:LayoutColumn>
                                            <ext:Panel ID="Panel5" runat="server" Width="35" BodyStyle="background-color: transparent;"
                                                Border="false" Layout="Anchor">
                                                <Items>
                                                    <ext:Panel ID="Panel6" runat="server" Border="false" BodyStyle="background-color: transparent;"
                                                        AnchorVertical="40%" AnchorHorizontal="100%" />
                                                    <ext:Panel ID="Panel7" runat="server" Border="false" BodyStyle="background-color: transparent;"
                                                        Padding="5">
                                                        <Items>
                                                            <ext:Button ID="Button4" runat="server" Icon="ResultsetNext" StyleSpec="margin-bottom:2px;">
                                                                <Listeners>
                                                                    <Click Handler="ServiceSelector.add();" />
                                                                </Listeners>
                                                                <ToolTips>
                                                                    <ext:ToolTip ID="ToolTip1" runat="server" Title="Add" Html="Add Selected Rows" />
                                                                </ToolTips>
                                                            </ext:Button>
                                                            <%-- <ext:Button ID="Button5" runat="server" Icon="ResultsetLast" StyleSpec="margin-bottom:2px;">
                                                   <Listeners>
                                                       <Click Handler="ServiceSelector.addAll();" />
                                                   </Listeners>
                                                   <ToolTips>
                                                       <ext:ToolTip ID="ToolTip2" runat="server" Title="Add all" Html="Add All Rows" />
                                                   </ToolTips>
                                               </ext:Button>--%>
                                                            <ext:Button ID="Button6" runat="server" Icon="ResultsetPrevious" StyleSpec="margin-bottom:2px;">
                                                                <Listeners>
                                                                    <Click Handler="ServiceSelector.remove(GridPanel2, GridPanel3);" />
                                                                </Listeners>
                                                                <ToolTips>
                                                                    <ext:ToolTip ID="ToolTip3" runat="server" Title="Remove" Html="Remove Selected Rows" />
                                                                </ToolTips>
                                                            </ext:Button>
                                                            <%-- <ext:Button ID="Button7" runat="server" Icon="ResultsetFirst" StyleSpec="margin-bottom:2px;">
                                                   <Listeners>
                                                       <Click Handler="ServiceSelector.removeAll(GridPanel1, GridPanel2);" />
                                                   </Listeners>
                                                   <ToolTips>
                                                       <ext:ToolTip ID="ToolTip4" runat="server" Title="Remove all" Html="Remove All Rows" />
                                                   </ToolTips>
                                               </ext:Button>--%>
                                                        </Items>
                                                    </ext:Panel>
                                                </Items>
                                            </ext:Panel>
                                        </ext:LayoutColumn>
                                        <ext:LayoutColumn ColumnWidth="0.5">
                                            <ext:GridPanel runat="server" ID="GridPanel3" EnableDragDrop="false" AutoExpandColumn="ServiceName"
                                                StoreID="SelectedStore">
                                                <Listeners>
                                                </Listeners>
                                                <ColumnModel ID="ColumnModel3" runat="server">
                                                    <Columns>
                                                        <ext:Column ColumnID="Country" Header="Selected Service" DataIndex="ServiceName" />
                                                    </Columns>
                                                </ColumnModel>
                                                <SelectionModel>
                                                    <ext:RowSelectionModel ID="RowSelectionModel2" runat="server" />
                                                </SelectionModel>
                                                <%--<SaveMask ShowMask="true" />--%>
                                            </ext:GridPanel>
                                        </ext:LayoutColumn>
                                    </Columns>
                                </ext:ColumnLayout>
                            </Items>
                        </ext:Panel>
                    </Items>
                </ext:TabPanel>
            </Items>
        </ext:Window>
  6. #6
    Hi vaishali

    Yeah the above code is same

    but add remove validation code

    protected void CheckUserName(object sender, RemoteValidationEventArgs e)
        {
           if(txtusername.text="")
    {
           e.Success = false;
            e.ErrorMessage = "'Valid' is valid value only";
    }else{
       e.Success = true;
            
    }
             
            System.Threading.Thread.Sleep(1000);
        }

    and enable remotevalidation="true" on aspx page
  7. #7
    Hi Hardik


    I have already add the code as
     protected void CheckUserName(object sender, RemoteValidationEventArgs e)
            {
                TextField field = (TextField)sender;
                if (UId == 0)
                {
                    objuser.UserName = field.Text;
                    objuser.Select_CheckUser();
                    if (objuser.UserId == 0)
                    {
                        e.Success = true;
                    }
                    else
                    {
                        e.Success = false;
                        e.ErrorMessage = "UserName Already Exists.";
                    }
                    System.Threading.Thread.Sleep(1000);
                }
                else
                {
                    objuser.UserName = field.Text;
                    objuser.Select_CheckUser();
                    UserMaster objtemp = new UserMaster();
                    objtemp.UserId = UId;
                    objtemp.Select();
                    if (objuser.UserId == 0)
                    {
                        e.Success = true;
                    }
                    else if (objtemp.UserName == field.Text)
                    {
                        e.Success = true;
                    }
                    else
                    {
                        e.Success = false;
                        e.ErrorMessage = "UserName Already Exists.";
                    }
                  
                    System.Threading.Thread.Sleep(1000);
                }
            }
    What else I have to write that I want to know??????????????????????
  8. #8
    I think you are not getting me or may be
    I m not getting U.
    My scenerio is that when I click on savebutton the remote validation is perform(check username & password) in two different fields-> Record saved successfully
    But when I click on edit txtPassword and txtConfirm is disabled. So for this reson remote validation is not perform on txtConfirm, also remotevalidation on txtUsername is not perform because the field set its data when I click on edit, So form.isvalid return false

    So for this reason what I have to add so that form.isvalid should return true

Similar Threads

  1. Replies: 2
    Last Post: Jan 18, 2012, 5:24 PM
  2. [FIXED] [RC2] Invalid field tooltip
    By nightik in forum Bugs
    Replies: 2
    Last Post: Jun 09, 2011, 5:05 PM
  3. [CLOSED] How to make a FormPanel field invalid usign code behind?
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 22, 2010, 5:49 AM
  4. Replies: 6
    Last Post: May 25, 2010, 9:53 AM
  5. Help, FormPanel Validation Invalid
    By diego in forum 1.x Help
    Replies: 0
    Last Post: Jan 21, 2010, 11:23 AM

Posting Permissions