PDA

View Full Version : [CLOSED] Password Validation does not work



hdsoso
May 07, 2013, 12:29 AM
according http://examples2.ext.net/#/Form/TextField/Password_Validation/
and http://examples2.ext.net/#/Form/TextField/Password_Mask/
I code below


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="extdemo.pages.login" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户注册-crm客户关系系统</title>
<link href="../images/style.css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>

<ext:Viewport ID="Viewport1" runat="server">
<LayoutConfig>
<ext:HBoxLayoutConfig Pack="Center"></ext:HBoxLayoutConfig>
</LayoutConfig>
<Items>
<ext:Panel runat="server" Border="False" Height="900">
<LayoutConfig>
<ext:VBoxLayoutConfig Pack="Center"></ext:VBoxLayoutConfig>
</LayoutConfig>
<Items>
<ext:Panel runat="server" Border="False">
<Content>
<h2 class="hdsoso_title">crm客户关系系统</h2>
</Content>
</ext:Panel>
<ext:TabPanel runat="server" Width="350" ID="ctl344">

<Items>
<ext:Panel ID="Panel1" runat="server" Title="登陆" BodyPadding="5">
<LayoutConfig>
<ext:HBoxLayoutConfig Pack="Center"></ext:HBoxLayoutConfig>
</LayoutConfig>
<Items>
<ext:Panel
ID="Window1"
runat="server"
Closable="false"
Resizable="false"
Title="用户登陆"
Draggable="false"
Width="330"
BodyPadding="5"
Layout="FormLayout" DefaultButton="btnLogin">
<Items>
<ext:TextField
ID="txtUsername"
runat="server"
FieldLabel="用户名"
AllowBlank="false"
BlankText="请输入用户名">
<Listeners>
<AfterRender Handler="#{txtUsername}.focus(false,200);">
</AfterRender>
</Listeners>
</ext:TextField>
<ext:TextField
ID="txtPassword"
runat="server"
InputType="Password"
FieldLabel="密码"
AllowBlank="false"
BlankText="请输入密码" />
</Items>
<Buttons>

<ext:Button ID="btnLogin" runat="server" Text="登陆" Icon="DoorIn">
<DirectEvents>
<Click OnEvent="btnLogin_Click">
<EventMask ShowMask="true" Msg="正在验证..." MinDelay="500" />
</Click>
</DirectEvents>
</ext:Button>

</Buttons>
</ext:Panel>
</Items>
</ext:Panel>
<ext:Panel ID="Panel2" runat="server" Title="注册" BodyPadding="5" Width="330">
<LayoutConfig>
<ext:HBoxLayoutConfig Pack="Center"></ext:HBoxLayoutConfig>
</LayoutConfig>
<Items>
<ext:Panel ID="Window2" runat="server" Layout="FormLayout" Title="用户注册" Width="330" BodyPadding="5">
<Defaults>
<ext:Parameter Name="LabelWidth" Value="125" Mode="Raw" />
</Defaults>
<Items>
<ext:TextField ID="txtEmail" FieldLabel="邮箱" runat="server" Vtype="email"></ext:TextField>
<ext:TextField ID="txtname" FieldLabel="用户名" runat="server"></ext:TextField>
<ext:TextField ID="txtpass" FieldLabel="密码" runat="server">
<Plugins>
<ext:PasswordMask ID="PasswordMask1" runat="server" />

<ext:CapsLockDetector ID="CapsLockDetector1" runat="server">
<Listeners>
<CapsLockOn Handler="#{txtpass}.showIndicator({iconCls : '#Error', tip : '大写锁定已打开'});" />
<CapsLockOff Handler="#{txtpass}.hideIndicator();" />
</Listeners>
</ext:CapsLockDetector>
</Plugins>
<Listeners>
<ValidityChange Handler="this.next().validate();" />
<Blur Handler="this.next().validate();" />
</Listeners>
</ext:TextField>
<ext:TextField ID="txtpass1" FieldLabel="确认密码" runat="server" AnchorHorizontal="100%">
<Plugins>
<ext:PasswordMask ID="PasswordMask2" runat="server" />
</Plugins>
<CustomConfig>
<ext:ConfigItem Name="initialPassField" Value="txtpass" Mode="Value" />
</CustomConfig>
</ext:TextField>
</Items>
<Buttons>
<ext:Button ID="Button1" runat="server" Text="注册" Icon="UserAdd"></ext:Button>
</Buttons>
</ext:Panel>
</Items>
</ext:Panel>

</Items>
</ext:TabPanel>
</Items>
</ext:Panel>



</Items>
</ext:Viewport>
</form>
</body>
</html>



Password Mask works fine, but Password Validation dose not work.
may I miss something?
thanks

Baidaly
May 07, 2013, 1:32 AM
Hello!

It seems that you forgot set
Vtype="password"



<ext:TextField ID="txtpass" FieldLabel="??" runat="server">
<Plugins>
<ext:PasswordMask ID="PasswordMask1" runat="server" />

<ext:CapsLockDetector ID="CapsLockDetector1" runat="server">
<Listeners>
<CapsLockOn Handler="#{txtpass}.showIndicator({iconCls : '#Error', tip : '???????'});" />
<CapsLockOff Handler="#{txtpass}.hideIndicator();" />
</Listeners>
</ext:CapsLockDetector>
</Plugins>
<Listeners>
<ValidityChange Handler="this.next().validate();" />
<Blur Handler="this.next().validate();" />
</Listeners>
</ext:TextField>
<ext:TextField ID="txtpass1" FieldLabel="????" runat="server" AnchorHorizontal="100%" Vtype="password">
<Plugins>
<ext:PasswordMask ID="PasswordMask2" runat="server" />
</Plugins>
<CustomConfig>
<ext:ConfigItem Name="initialPassField" Value="txtpass" Mode="Value" />
</CustomConfig>
</ext:TextField>

hdsoso
May 07, 2013, 1:56 PM
Hello!

It seems that you forgot set
Vtype="password"



<ext:TextField ID="txtpass" FieldLabel="??" runat="server">
<Plugins>
<ext:PasswordMask ID="PasswordMask1" runat="server" />

<ext:CapsLockDetector ID="CapsLockDetector1" runat="server">
<Listeners>
<CapsLockOn Handler="#{txtpass}.showIndicator({iconCls : '#Error', tip : '???????'});" />
<CapsLockOff Handler="#{txtpass}.hideIndicator();" />
</Listeners>
</ext:CapsLockDetector>
</Plugins>
<Listeners>
<ValidityChange Handler="this.next().validate();" />
<Blur Handler="this.next().validate();" />
</Listeners>
</ext:TextField>
<ext:TextField ID="txtpass1" FieldLabel="????" runat="server" AnchorHorizontal="100%" Vtype="password">
<Plugins>
<ext:PasswordMask ID="PasswordMask2" runat="server" />
</Plugins>
<CustomConfig>
<ext:ConfigItem Name="initialPassField" Value="txtpass" Mode="Value" />
</CustomConfig>
</ext:TextField>

how to custom define the error message "passwords do not match"
6169

Daniil
May 07, 2013, 2:35 PM
Please set up

VtypeText="Custom text"
for a TextField.