Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7636093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:35:08+00:00 2026-05-31T07:35:08+00:00

I want to add a simple validator to verify that password and confirm password

  • 0

I want to add a simple validator to verify that “password” and “confirm password” are equal, here is the code :

Ext.apply('Ext.form.VTypes',{
password : function(val, field) {
    if (field.initialPassField) {
        var pwd = Ext.getCmp(field.initialPassField);
        return (val == pwd.getValue());
    }
    return true;
},

passwordText : 'Passwords do not match'
});
var genders = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data : [
    {"abbr":"AL", "name":"Male"},
    {"abbr":"AK", "name":"Female"}        
]
});

//****************************************
Ext.define('AM.view.user.Inscription', {
    extend: 'Ext.form.Panel',
    alias: 'widget.inscription',
    title: 'Formulaire',
    fieldDefaults: {
        labelAlign: 'right',
        msgTarget: 'side'
    },
      items: [{
        xtype: 'container',
        anchor: '100%',
        layout:'column',
        items:[{
                xtype:'textfield',
                fieldLabel: 'First Name',
                name: 'first',
                allowBlank:false,
                anchor:'40%',
                //maxLength : '10'
            },{
                xtype:'textfield',
                fieldLabel: 'Last Name',
                name: 'last',
                allowBlank:false,
                anchor:'40%'
            },{
                    xtype:'textfield',
                inputType: 'password',
                fieldLabel:'Password',
                name:'pass',
                id : 'pass',
                allowBlank:false,
                anchor:'40%'
            },{
                xtype:'textfield',
                inputType: 'password',
                fieldLabel:'Confirm Password',
                name:'confirmPass',
                allowBlank:false,
        vtype : 'password',
        initialPassField : 'pass',
        //autoRender : true,
                anchor:'40%'
            }]
        },{
            xtype: 'container',
            columnWidth:.5,
            layout: 'anchor',
            items: [{
                xty pe:'combobox',
                fieldLabel: 'Sexe',
                store: genders,
                queryMode: 'local',
                displayField: 'name',
                allowBlank : false,
                name: 'gender',
                editable : false,
                anchor:'30%',

            },{
                xtype:'textfield',
                fieldLabel: 'N° Téléphone',
                name: 'phone',
                allowBlank:false,
                anchor:'40%'
            }]
        }]
    }],

    buttons: [{
        text: 'Save'
    },{
        text: 'Reset'
    },{
        text: 'Cancel'
    }]
});

whene I start write in the confirm password textfield I get this in chrome developer tool :
Uncaught TypeError: Object [object Object] has no method 'password'

can someone tell me what I miss here ? thank you at advance.

UPDATE

the application is an MVC application and this file (the code above) is in View folder, and I’m calling this view in the app.js like this :

 Ext.require([
'Ext.panel.*',
'Ext.toolbar.*',
'Ext.button.*',
'Ext.container.ButtonGroup',
'Ext.layout.container.Table'
]);
Ext.application({
name: 'AM',
appFolder: 'app',
controllers: [
    'Users'
],
launch: function() {
   Ext.create('Ext.container.Viewport', {
       layout : 'auto',
       //layout : 'vbox',
       renderTo: document.body,
        items: [{
            xtype : 'usertoolbar',
        },{  
            html : '<br><br>' 
        },{
            xtype: 'inscription',
        },{
            xtype: 'userlist',
    }]
    });
  }
});

Also any notes about my methodology of structuring code are welcome

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:35:09+00:00Added an answer on May 31, 2026 at 7:35 am

    Change Ext.form.VTypes to Ext.form.field.VTypes in the first line. See if it helps.

    Update: change your validate function to:

    password : function(val, field) {
        console.log(val, field);
        if (field.initialPassField) {
            var pwd = Ext.getCmp(field.initialPassField);
            console.log(pwd);
            return (val == pwd.getValue());
        }
        return true;
    },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a simple form validation using javascript and want to add some
I want to add a simple php script to my contact webpage. So that
In my application I want to add a simple animation to buttons and other
This is a simple requirement: I want to add a set of strings to
I have a simple jsp/servlet application and I want to add AJAX feature to
I have a really simple blog application and I want to add a really
I am trying a very simple override. I just want to add one line
I'm doing a simple slideUp animation on an object. I want to add attribute
I created a simple input field for an int variable. I want to add
Richfaces 3.3.3, Jsf 1.2: I have a a4j:form that uses some simple validation, mainly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.