[CLOSED] Any way to display a TextField icon when validation is successful?

  1. #1

    [CLOSED] Any way to display a TextField icon when validation is successful?

    Hello,

    I've got a textfield that asks for your password. I'm using remote validation to check to see if what you entered is correct.

    When it's incorrect, the textfield shows a red circle with an exclamation (standard error icon).

    If it's correct, I'd like to show a green Tick icon.

    Is this possible?

    Here's the code snippet:

    <ext:TextField ID="tfCurrentPassword" runat="server" FieldLabel="Current Password"
                                                InputType="Password" AllowBlank="false" IsRemoteValidation="true" MsgTarget="Side">
                                                    <RemoteValidation OnValidation="CheckPassword" />
                                                </ext:TextField>
    And here's the code behind:

        Protected Sub CheckPassword(ByVal sender As Object, ByVal e As Ext.Net.RemoteValidationEventArgs)
            Dim tfCurrentPassword As Ext.Net.TextField = sender
            If Not WAP.Core.Utilities.MD5Hash(tfCurrentPassword.Text) = MyUserAccount.Password_bn Then
                e.Success = False
                e.ErrorMessage = "The password entered is incorrect"
                SaveButton.Disabled = True
            Else
                e.Success = True
                SaveButton.Disabled = False
            End If
        End Sub
    Last edited by Daniil; May 31, 2011 at 10:41 AM. Reason: Please use [CODE] tags, [CLOSED]
  2. #2
    Hi,

    Please investigate the following sample
    https://examples1.ext.net/#/Form/Fie...ator/Overview/

    You can apply indicator icon on Valid event
  3. #3

    Icon not showing up on remote validation; Please see simple example

    My goal is to display a success icon to the user if they enter the correct password. Here is my sample code. Perhaps you can tell me why it isn't working.

    Thanks.

    <%@ Page Language="vb" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        Protected Sub CheckPassword(ByVal sender As Object, ByVal e As RemoteValidationEventArgs)
            If txtPassword.Text = "12345" Then
                e.Success = True
                txtPassword.IndicatorIcon = Icon.Tick
                'ResourceManagerControl.RegisterIcon(Icon.Tick)
            Else
                e.Success = False
                e.ErrorMessage = "Invalid Password"
            End If
        End Sub
    </script>
    <!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></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManagerControl" runat="server" />
        <ext:FormPanel ID="fpCurrentPassword" runat="server" Border="false" LabelWidth="150" StyleSpec="padding-top:10px">
            <Items>
                <ext:TextField ID="txtPassword" runat="server" FieldLabel="Password" IndicatorIcon="Information"
                    InputType="Password" IsRemoteValidation="true" IndicatorTip="Enter Your Password" MsgTarget="Side">
                    <RemoteValidation OnValidation="CheckPassword" />    
                </ext:TextField>
            </Items>
        </ext:FormPanel>
        </form>
    </body>
    </html>
  4. #4
    Hi,

    Please see the following sample
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!X.IsAjaxRequest)
            {
                ResourceManagerControl.RegisterIcon(Icon.Tick);    
            }
        }
        
        protected void CheckPassword(object sender, RemoteValidationEventArgs e)
        {
    	    if (txtPassword.Text == "12345") {
    		    e.Success = true;
    	    } else {
    		    e.Success = false;
    		    e.ErrorMessage = "Invalid Password";
    	    }
        }
    </script>
    <!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></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManagerControl" runat="server" />
        <ext:FormPanel ID="fpCurrentPassword" runat="server" Border="false" LabelWidth="150" StyleSpec="padding-top:10px">
            <Items>
                <ext:TextField ID="txtPassword" runat="server" FieldLabel="Password" IndicatorIcon="Information"
                    InputType="Password" IsRemoteValidation="true" IndicatorTip="Enter Your Password" MsgTarget="Side">
                    <RemoteValidation OnValidation="CheckPassword" />
                    <Listeners>
                        <RemoteValidationValid Handler="this.setIndicatorIconCls('icon-tick'); this.alignIndicator();" />
                    </Listeners>
                </ext:TextField>
            </Items>
        </ext:FormPanel>
        </form>
    </body>
    </html>

Similar Threads

  1. [CLOSED] GridCommand icon doesn't display
    By Daly_AF in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 06, 2012, 8:48 AM
  2. Replies: 3
    Last Post: Jun 27, 2012, 2:19 PM
  3. [CLOSED] FireFox 13.0 and ext:TextField icon: icon untidy.
    By supera in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Jun 18, 2012, 5:21 PM
  4. [CLOSED] ArrowRefresh icon won't display
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Feb 27, 2012, 1:10 PM
  5. [CLOSED] display icon when invalid validation
    By rnfigueira in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 22, 2011, 2:33 PM

Posting Permissions