View Full Version : form validation with markinvalid, isvalid, etc

jochem kuun
1 Mar 2011, 2:25 AM

for a project i have to validate forms. I'm using a formpanel to show the form. it has some inputfields on it , and a submit button. Looking at the API, it should be possible to call isValid on a formpanel, or at least on formpanel.getForm(). But i get the following error when doing just that. First the democode:

var f = new Ext.form.FormPanel({

items: [
xtype: 'textfield',
name : 'username',
label: 'Gebruikersnaam',
useClearIcon: true,
autoCapitalize : false,
placeHolder: 'Uw gebruikersnaam'
}, {
xtype: 'passwordfield',
name : 'password',
label: 'Wachtwoord',
useClearIcon: false,
placeHolder: 'Uw wachtwoord'
}, {
xtype: 'hiddenfield',
name : 'secret',
value: 'false'

f.setValues({'username': 'test', 'password': 'pass'});
// the above all goes well: an object with the right values gets logged


// these generate the following error:
// Uncaught TypeError: Object [object Object] has no method 'isValid'

// while the following proves i am working with a formpanel ( xtype = form)

It seems that the markinvaid functions are not available, or I am defenetly doing someting wrong.
Please, enlighten me!

Thank you.