password confirm

  1. #1

    password confirm

    hi..
    i use coolite 0.8.2 and i want create a function for password confirm, in extjs i use:

    
    password : function(val, field) {
            if (field.initialPassField) {
                var pwd = Ext.getCmp(field.initialPassField);
                return (val == pwd.getValue());
            }
            return true;
        },
    
        passwordText : 'Passwords do not match'
    how it's possible create a confirm password in coolite 0.8.2 ?




  2. #2

    RE: password confirm

    Hi,

    Ext.Net already has that type validation
    https://examples1.ext.net/#/Form/Tex...rd_Validation/

    For 0.8.2 you have to add that validation manually
    Ext.apply(Ext.form.VTypes, {    
        password : function (val, field) {
            if (field.initialPassField) {
                var pwd = Ext.getCmp(field.initialPassField);
                return pwd ? (val == pwd.getValue()) : false;
            }
            
            return true;
        },
    
        passwordText : "Passwords do not match"
    });
    and use it how in the above Ext.Net sample

    Or use 'Validator' function of the confirm field to apply own validation logic

    validator : Function<div class="mdesc" style="margin: 0px; padding: 5px 0px; color: rgb(68, 68, 68);"><div class="long" style="margin: 0px; padding: 0px; display: block; line-height: 18px;"><p style="margin: 0px; padding: 0px;">A custom validation function to be called during field validation (validateValue) (defaults to <tt>null</tt>). If specified, this function will be called first, allowing the developer to override the default validation process.</p>
    <p style="margin: 0px; padding: 0px;">This function will be passed the following Parameters:</p><div class="mdetail-params" style="margin: 10px 0px 0px; padding: 0px 0px 0px 12px; font-size: 12px;"><ul style="margin: 12px; padding: 0px; list-style-type: circle; list-style-position: inside;"><li style="margin: 0px; padding: 0px; list-style-position: inside; list-style-type: circle;"><code style="font-style: normal; font-weight: normal; font-family: 'Lucida Console','Courier New',Courier,monospace; font-size: 12px;">value</code>: Mixed<div class="sub-desc" style="margin: 5px 5px 5px 16px; padding: 0px;">The current field value[/list]

    <p style="margin: 0px; padding: 0px;">This function is to Return:</p><div class="mdetail-params" style="margin: 10px 0px 0px; padding: 0px 0px 0px 12px; font-size: 12px;"><ul style="margin: 12px; padding: 0px; list-style-type: circle; list-style-position: inside;"><li style="margin: 0px; padding: 0px; list-style-position: inside; list-style-type: circle;"><code style="font-style: normal; font-weight: normal; font-family: 'Lucida Console','Courier New',Courier,monospace; font-size: 12px;">true</code>: Boolean<div class="sub-desc" style="margin: 5px 5px 5px 16px; padding: 0px;"><code style="font-style: normal; font-weight: normal; font-family: 'Lucida Console','Courier New',Courier,monospace; font-size: 12px;">true</code> if the value is valid
    <li style="margin: 0px; padding: 0px; list-style-position: inside; list-style-type: circle;"><code style="font-style: normal; font-weight: normal; font-family: 'Lucida Console','Courier New',Courier,monospace; font-size: 12px;">msg</code>: String<div class="sub-desc" style="margin: 5px 5px 5px 16px; padding: 0px;">An error message if the value is invalid[/list]



  3. #3

    RE: password confirm

    it's possible to have an example with validator function ?


  4. #4
    Hi, maxdiable

    I write this code to validate passwords:

     
    ...
     <script type="text/javascript"> 
           var validatePassword = function (control1, control2) {
                control1.validate();
                control2.validate();
                if (control1.getValue() != control2.getValue() && control1.getValue() != '' && control2.getValue() != '') {
                    control1.markInvalid("Passwords no do match");
                    control2.markInvalid("Passwords no do match");
                    return false;
                }
                return true;
            }
    </script>
     
    ...
    ...
     
    <ext:TextField ID="txtPassword1" runat="server" Width="300" InputType="Password"  AllowBlank="false" >
        <Listeners>
               <Change Handler="validatePassword(txtPassword1, txtPassword2);" />
        </Listeners>
    </ext:TextField>
     
    ...
     
    <ext:TextField ID="txtPassword2" runat="server" Width="300" InputType="Password"  AllowBlank="false" >
        <Listeners>
               <Change Handler="validatePassword(txtPassword1, txtPassword2);" />
        </Listeners>
    </ext:TextField>
     
    ...
    I hope it will be usefull to you :)

    Regards,

Similar Threads

  1. [CLOSED] Ext.Msg.Confirm vs Confirm with DirectEvents
    By csharpdev in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 21, 2013, 10:51 AM
  2. Replies: 2
    Last Post: Jul 10, 2012, 8:09 PM
  3. Implement a Password Meter to a Password Field
    By sudantha in forum 1.x Help
    Replies: 1
    Last Post: Jan 15, 2012, 6:59 AM
  4. [CLOSED] pls help how to recover svn password
    By dev in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 03, 2011, 5:06 PM
  5. Password column in gridpanel
    By Richardt in forum 1.x Help
    Replies: 0
    Last Post: Feb 09, 2011, 8:18 AM

Posting Permissions