[CLOSED] TextField with PasswordMask getValue() to validate password match

  1. #1

    [CLOSED] TextField with PasswordMask getValue() to validate password match

    Hi, How Can I to get the value of TextField with of plugin PasswordMask because I get asterisk:



    And How Can I to validate the two textField Password to confirmation password, and ValidityChange of FormaPanel this work, this is my code:

            <ext:FormPanel
                ID="fpUsuario"
                runat="server"
                BodyPadding="10"
                ButtonAlign="Right"
                Width="750"
                Height="380">
                <Items>
                    <ext:TextField
                        ID="txtfContrasena"
                        runat="server"
                        FieldLabel="Contrase?a"
                        LabelWidth="105"
                        MaxLength="50"
                        EnforceMaxLength="true"
                        AllowBlank="false"
                        Width="350"
                        StyleSpec="margin-right: 6px;">
                        <Plugins>
                            <ext:PasswordMask ID="pmContrasena" runat="server">
                            </ext:PasswordMask>
                            <ext:CapsLockDetector ID="cldContrasena" runat="server">
                                <Listeners>
                                    <CapsLockOn Handler="#{txtfContrasena}.showIndicator({iconCls : '#Error', tip : 'BloqMay?s esta activado'});" />
                                    <CapsLockOff Handler="#{txtfContrasena}.hideIndicator();" />
                                </Listeners>
                            </ext:CapsLockDetector>
                        </Plugins>
                    </ext:TextField>
                    <ext:TextField
                        ID="txtfConfirmarContrasena"
                        runat="server"
                        FieldLabel="Confirmar"
                        LabelWidth="105"
                        MaxLength="50"
                        EnforceMaxLength="true"
                        AllowBlank="false"
                        Width="350"
                        StyleSpec="margin-right: 6px;">
                        <Plugins>
                            <ext:PasswordMask ID="pmConfirmarContrasena" runat="server"  />
                            <ext:CapsLockDetector ID="cldConfirmarContrasena" runat="server">
                                <Listeners>
                                    <CapsLockOn Handler="#{txtfConfirmarContrasena}.showIndicator({iconCls : '#Error', tip : 'BloqMay?s esta activado'});" />
                                    <CapsLockOff Handler="#{txtfConfirmarContrasena}.hideIndicator();" />
                                </Listeners>
                            </ext:CapsLockDetector>
                        </Plugins>
                    </ext:TextField>
                </Items>
                <Listeners>
                    <ValidityChange Handler="this.dockedItems.get(0).setStatus({
                                                    text : valid ? 'La informaci?n esta completa/correcta' : 'Existe informaci?n incompleta/incorrecta', 
                                                    iconCls: valid ? 'icon-accept' : 'icon-exclamation'
                                                });
                                                #{imgbtnGuardar}.setDisabled(!valid);" />
                </Listeners>
                <Buttons>
                    <ext:Button
                        ID="imgbtnGuardar" 
                        runat="server"
                        Disabled="true"
                        Text="Save">
                    </ext:Button>
                </Buttons>
                <BottomBar>
                    <ext:StatusBar
                        ID="sbUsuario" 
                        runat="server" 
                        Cls="x-colorToolbar"
                        Text="Sin validar informaci?n" />
                </BottomBar>
            </ext:FormPanel>
    Attached Thumbnails Click image for larger version. 

Name:	PaswordMask01.png 
Views:	9 
Size:	28.5 KB 
ID:	18832  
    Last edited by Daniil; Jan 14, 2015 at 6:41 AM. Reason: [CLOSED]
  2. #2
    This is the solution:

                                    <ext:TextField
                                        ID="txtfContrasena"
                                        runat="server"
                                        FieldLabel="Contrase?a"
                                        LabelWidth="105"
                                        MaxLength="50"
                                        EnforceMaxLength="true"
                                        AllowBlank="false"
                                        Width="350"
                                        StyleSpec="margin-right: 6px;"
                                        SubmitValue="false">
                                        <Validator Fn="txtfContrasena_Validator" />
                                        <Plugins>
                                            <ext:PasswordMask ID="pmContrasena" runat="server">
                                            </ext:PasswordMask>
                                            <ext:CapsLockDetector ID="cldContrasena" runat="server">
                                                <Listeners>
                                                    <CapsLockOn Handler="#{txtfContrasena}.showIndicator({iconCls : '#Error', tip : 'BloqMay?s esta activado'});" />
                                                    <CapsLockOff Handler="#{txtfContrasena}.hideIndicator();" />
                                                </Listeners>
                                            </ext:CapsLockDetector>
                                        </Plugins>
                                    </ext:TextField>
                                    <ext:TextField
                                        ID="txtfConfirmarContrasena"
                                        runat="server"
                                        FieldLabel="Confirmar"
                                        LabelWidth="105"
                                        MaxLength="50"
                                        EnforceMaxLength="true"
                                        AllowBlank="false"
                                        Width="350"
                                        StyleSpec="margin-right: 6px;"
                                        SubmitValue="false">
                                        <Validator Fn="txtfConfirmarContrasena_Validator" />
                                        <Plugins>
                                            <ext:PasswordMask ID="pmConfirmarContrasena" runat="server"  />
                                            <ext:CapsLockDetector ID="cldConfirmarContrasena" runat="server">
                                                <Listeners>
                                                    <CapsLockOn Handler="#{txtfConfirmarContrasena}.showIndicator({iconCls : '#Error', tip : 'BloqMay?s esta activado'});" />
                                                    <CapsLockOff Handler="#{txtfConfirmarContrasena}.hideIndicator();" />
                                                </Listeners>
                                            </ext:CapsLockDetector>
                                        </Plugins>
                                    </ext:TextField>
    var banderaValidate = false;
    
    //Validar el TextField de Contrase?a
    var txtfContrasena_Validator = function (valor) {
        if (App.txtfConfirmarContrasena.getPassword() == '') {
            return true;
        }
        else if (this.getPassword() == App.txtfConfirmarContrasena.getPassword()) {
            if (banderaValidate == false) {
                banderaValidate = true;
                App.txtfConfirmarContrasena.validate();
                banderaValidate = false;
            }
            return true;
        }
        else {
            return 'Las contrase?as no coinciden';
        }
    };
    
    //Validar el TextField de Confirmar Contrase?a
    var txtfConfirmarContrasena_Validator = function (valor) {
        if (App.txtfContrasena.getPassword() == '') {
            return true;
        }
        else if (this.getPassword() == App.txtfContrasena.getPassword()) {
            if (banderaValidate == false) {
                banderaValidate = true;
                App.txtfContrasena.validate();
                banderaValidate = false;
            }
            return true;
        }
        else {
            return 'Las contrase?as no coinciden';
        }
    };
    Last edited by osef; Jan 14, 2015 at 5:02 AM.

Similar Threads

  1. [CLOSED] Password fields TextField saves the password
    By ucaneto in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 29, 2014, 3:38 PM
  2. [CLOSED] compare validate in password not work in master page.
    By hdsoso in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 09, 2014, 1:40 PM
  3. Replies: 2
    Last Post: Feb 21, 2014, 7:06 AM
  4. [CLOSED] Problems with Password Validation and PasswordMask plugin
    By tactime10 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 10, 2013, 9:24 AM
  5. [CLOSED] TextField.getValue()
    By supera in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 24, 2012, 1:17 PM

Tags for this Thread

Posting Permissions