[CLOSED] Dynamics validation

  1. #1

    [CLOSED] Dynamics validation

    Hi I'm working in an application and I have different type of client in different country so For each country there are different form validation for the same form. I want to know if it's possible to dynamics validation per country with EXT.net.
    Last edited by Daniil; Nov 05, 2013 at 8:30 AM. Reason: [CLOSED]
  2. #2
    Hi @kakashi,

    Welcome to the Ext.NET forums!

    I am afraid I don't quite understand the following.
    dynamics validation per country
    Could you elaborate in details, please?

    Also please clarify do you use a FormPanel with Ext.NET fields?

    If so, you can configure validation as you need according to the current culture.

    Also you might need to set up the Culture or a ResourceManager's Locale.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @kakashi,

    Welcome to the Ext.NET forums!

    I am afraid I don't quite understand the following.


    Could you elaborate in details, please?

    Also please clarify do you use a FormPanel with Ext.NET fields?

    If so, you can configure validation as you need according to the current culture.

    Also you might need to set up the Culture or a ResourceManager's Locale.
    We use FormPanel, I joined an example of what I want. Click image for larger version. 

Name:	exemple.jpg 
Views:	12 
Size:	32.2 KB 
ID:	7137
    I want to know if Ext can allow me to do something like that. Dynamics validation on one formpanel controls.
  4. #4
    Hello!

    Welcome to our forum! You can do it in Page_Load method by setting AllowBlank property.

    Take a look at this sample:

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpRequest Request = HttpContext.Current.Request;
            if (Request.UserLanguages == null)
                return;
    
            string Lang = Request.UserLanguages[0];
            if (Lang  == "ru-RU")
            {
                FirstName.AllowBlank = false;
                LastName.AllowBlank = false;
                Company.AllowBlank = true;
                Email.AllowBlank = true;
            }
            
            if (Lang  == "en-US")
            {
                FirstName.AllowBlank = false;
                LastName.AllowBlank = false;
                Company.AllowBlank = false;
                Email.AllowBlank = false;
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>FormPanel Validation - Ext.NET Examples</title>
        <style>
            .icon-exclamation {
                padding-left: 25px !important;
                background: url(/icons/exclamation-png/ext.axd) no-repeat 3px 0px !important;
            }
            
            .icon-accept {
                padding-left: 25px !important;
                background: url(/icons/accept-png/ext.axd) no-repeat 3px 0px !important;
            }
        </style>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:Panel 
                runat="server" 
                Layout="FitLayout" 
                Width="600" 
                Height="250">
                <Items>
                    <ext:FormPanel 
                        ID="FormPanel1" 
                        runat="server" 
                        Title="FormPanel Validation (all fields required)"
                        BodyPadding="5"                     
                        ButtonAlign="Right"
                        Layout="Column">
                        <Items>
                            <ext:Panel 
                                runat="server" 
                                Border="false" 
                                Header="false" 
                                ColumnWidth=".5" 
                                Layout="Form" 
                                LabelAlign="Top">
                                <Items>
                                    <ext:TextField runat="server" ID="FirstName" FieldLabel="First Name" AnchorHorizontal="92%" />
                                    <ext:TextField runat="server" ID="Company" FieldLabel="Company" AnchorHorizontal="92%" />
                                </Items>
                            </ext:Panel>
                            <ext:Panel runat="server" Border="false" Layout="Form" ColumnWidth=".5" LabelAlign="Top">
                                <Items>
                                    <ext:TextField runat="server" ID="LastName" FieldLabel="Last Name" AnchorHorizontal="92%" />
                                    <ext:TextField runat="server" ID="Email" FieldLabel="Email" Vtype="email" AnchorHorizontal="92%" />
                                </Items>
                            </ext:Panel>
                        </Items>
                        <BottomBar>
                            <ext:StatusBar runat="server" />
                        </BottomBar>
                        <Listeners>
                            <ValidityChange Handler="this.dockedItems.get(1).setStatus({
                                                         text : valid ? 'Form is valid' : 'Form is invalid', 
                                                         iconCls: valid ? 'icon-accept' : 'icon-exclamation'
                                                     });
                                                     #{Button1}.setDisabled(!valid);" />
                        </Listeners>
                    </ext:FormPanel>
                </Items>
                <Buttons>
                    <ext:Button
                        ID="Button1"
                        runat="server" 
                        Text="Save"  
                        Disabled="true"
                        FormBind="true">
                        <Listeners>
                            <Click Handler="if (#{FormPanel1}.getForm().isValid()) {Ext.Msg.alert('Submit', 'Saved!');}else{Ext.Msg.show({icon: Ext.MessageBox.ERROR, msg: 'FormPanel is incorrect', buttons:Ext.Msg.OK});}" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button runat="server" Text="Cancel" />
                </Buttons>
            </ext:Panel>        
        </form>
    </body>
    </html>

Similar Threads

  1. Add dynamics menus in dynamic Tab Panel
    By adopilot in forum 2.x Help
    Replies: 0
    Last Post: Mar 08, 2013, 5:48 PM
  2. Validation ?
    By richard in forum 2.x Help
    Replies: 2
    Last Post: Jun 26, 2012, 2:53 AM
  3. Client Side Validation and Validation Status
    By speddi in forum 1.x Help
    Replies: 8
    Last Post: Nov 03, 2011, 11:24 AM
  4. Replies: 3
    Last Post: Jul 11, 2011, 9:43 AM
  5. Replies: 3
    Last Post: Oct 07, 2009, 6:32 PM

Posting Permissions