2.3 Remote Validation issue

  1. #1

    2.3 Remote Validation issue

    I think now readonly field don't do remote validation, but when I set a new value on field, the remote validation will be invoke again. I think the previous fixed (http://forums.ext.net/showthread.php...ote-validation) is not enough, I think if field is readonly, then remote validtion don't invoke any more unless I set field readonly to false(use setReadOnly(false)).

    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void TextField_Validation(object sender, RemoteValidationEventArgs e)
        {
            if (Convert.ToString(e.Value) == "abc")
                e.Success = true;
        }
    </script>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server"></ext:ResourceManager>
        <ext:Viewport ID="Viewport1" runat="server">
            <Items>
                <ext:FormPanel ID="FormPanel1" runat="server">
                    <Items>
                        <ext:TextField ID="TextField1" runat="server" FieldLabel="Name"
                            IsRemoteValidation="true" ReadOnly="true" Text="bcd">
                            <RemoteValidation OnValidation="TextField_Validation">
                            </RemoteValidation>
                        </ext:TextField>
                    </Items>
                    <Buttons>
                        <ext:Button runat="server" Text="Test" 
                            OnClientClick="#{TextField1}.setValue('xyz');#{FormPanel1}.validate();"></ext:Button>
                    </Buttons>
                </ext:FormPanel>
            </Items>
        </ext:Viewport>
    </body>
    </html>
    Addtional, below code can stop invoke remote validation, but the loading icon will appear yet.

    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void TextField_Validation(object sender, RemoteValidationEventArgs e)
        {
            if (Convert.ToString(e.Value) == "abc")
                e.Success = true;
        }
    </script>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server"></ext:ResourceManager>
        <ext:Viewport ID="Viewport1" runat="server">
            <Items>
                <ext:FormPanel ID="FormPanel1" runat="server">
                    <Items>
                        <ext:TextField ID="TextField1" runat="server" FieldLabel="Name"
                            IsRemoteValidation="true" ReadOnly="false" Text="bcd">
                            <RemoteValidation OnValidation="TextField_Validation" Before="return false;">
                            </RemoteValidation>
                        </ext:TextField>
                    </Items>
                </ext:FormPanel>
            </Items>
        </ext:Viewport>
    </body>
    </html>
    Last edited by devil; Oct 14, 2013 at 9:31 AM. Reason: add ext.net version number
  2. #2
    It is not bug, ReadOnly should not skip validation if a value is changed via script (it prevents direct changes from keyboard)
    To activate/deactivate remore validation you have to use 'activateRemoteValidation'/'deactivateRemoteValidation' methods of the field
  3. #3
    Addtional, below code can stop invoke remote validation, but the loading icon will appear yet.
    Return false from 'Before' handler just prevents request only, it doesn't prevent pre request logic
    You have to use BeforeRemoteValidation listener
    <BeforeRemoteValidation Handler="return false;" />
  4. #4
    Oh, I got it, thank you! you can close this thread.
  5. #5
    Hello!

    The thread has been moved to 2.x Help forum.

Similar Threads

  1. Replies: 2
    Last Post: Oct 15, 2013, 12:05 AM
  2. [CLOSED] Remote Validation questions
    By bogc in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 06, 2013, 6:07 AM
  3. [CLOSED] FormPanel textfield w/remote validation reset issue
    By jwhitmire36 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 04, 2013, 3:21 PM
  4. Replies: 3
    Last Post: Jul 11, 2011, 9:43 AM
  5. Remote Validation
    By olimpia in forum 1.x Help
    Replies: 0
    Last Post: Jun 12, 2009, 7:39 PM

Tags for this Thread

Posting Permissions