[CLOSED] Validation one control

Page 1 of 6 123 ... LastLast
  1. #1

    [CLOSED] Validation one control

    Validation is done through the # {} FormPanel1. GetForm (). IsValid (). How do I get client-side validation only one control Ex?
    Last edited by Daniil; May 17, 2011 at 2:54 PM. Reason: [CLOSED]
  2. #2
    Hi,

    All fields (Ext.Net.Field inheritors) have the client side .isValid() method.
  3. #3

    validation

    how can I test whether a control can be validated or not? I ask this because a Panel I can not call the isValid ()
  4. #4
    You can use the following code:

    if (c.isValid) {
        c.isValid();
    }
  5. #5

    continuation

    I created the function below but when I call the method validCtr gives error. Where might be the problem? The call is validCtr (panel1);

            Ext.onReady(function () {
                var isValidControls = true;
    
                var validCtr = function (container) {
                    container.items.each(function (controlId) {
    
                        if (controlId.isValid) {
                            if (!controlId.isValid()) {
                                isValidControls = false;
    
                            }
                        }
                        //if (controlId1.getXType() == "panel") {
                        if (controlId.id != container.id) {
                            if (typeof (controlId.items) == "object") {
    
                                return validCtr(controlId);
    
                            }
                        }
    
    
                    });
    
                }        
               
            });
  6. #6
    I have tested your code and it appears to be working fine.

    Why do not you want to use .cascade() method? I would extremely reduce validation code.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    
        <script type="text/javascript">
            var validate = function (container) {
                container.myIsValid = true;
                container.cascade(
                    function (c) {
                        if (c.isValid) {
                            this.myIsValid = c.isValid();
                        }
                    },
                    container); 
                alert(container.myIsValid);   
            }
        </script>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Panel ID="Panel1" runat="server">
            <Items>
                <ext:NumberField runat="server" AllowBlank="false" />
                <ext:TextField runat="server" AllowBlank="false" />
                <ext:Panel runat="server">
                    <Items>
                        <ext:NumberField runat="server" AllowBlank="false" />
                        <ext:TextField runat="server" AllowBlank="false" />
                        <ext:Panel runat="server">
                            <Items>
                                <ext:NumberField runat="server" AllowBlank="false" />
                                <ext:TextField runat="server" AllowBlank="false" />
                            </Items>
                        </ext:Panel>
                    </Items>
                </ext:Panel>
            </Items>
        </ext:Panel>
        <ext:Button runat="server" Text="Validate">
            <Listeners>
                <Click Handler="validate(Panel1)" />
            </Listeners>
        </ext:Button>
        </form>
    </body>
    </html>
  7. #7
    I tried but it always returns true (alert (container.myIsValid))
  8. #8
    Did you try exactly the sample I posted or applied the code on your page?
  9. #9
    only put your javascript on my page
  10. #10
    Then please provide your sample to reproduce.
Page 1 of 6 123 ... LastLast

Similar Threads

  1. Set control validation after checkbox is checked
    By HexElffilter in forum 1.x Help
    Replies: 1
    Last Post: Feb 16, 2012, 2:21 PM
  2. Asp.Net Validation Control with Ext.Net Controls
    By huzzy143 in forum 1.x Help
    Replies: 2
    Last Post: Sep 08, 2011, 8:32 PM
  3. Replies: 3
    Last Post: Jul 11, 2011, 9:43 AM
  4. How to use Validation Control in Coolite V0.8
    By rbalajiprasad in forum 1.x Help
    Replies: 1
    Last Post: Aug 24, 2010, 5:17 PM
  5. [CLOSED] Form Validation within template of a asp:login control
    By ljcorreia in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Nov 27, 2009, 12:15 PM

Posting Permissions