PDA

View Full Version : Invalid Label



captainm1uk
9 Nov 2007, 5:43 AM
Hi Zakaroonikov has been great in doing this code for me to create an ext login page for my database but I get an error saying invalid label at the point of loginDialog : function....

Here is the code



/**
* Displays the login dialog box
*/
Login : {
/**
* Login CB
*/
loginCB: function(options,success,response) {
if (response.responseText.indexOf('<form method="post" action="/names.nsf?Login">') != -1) {
var statusEl = Ext.get(this.id);
statusEl.update("Invalid username / password<br /> Please Try again");
} else {
window.location.hash = '';
window.location.reload(true);
}
},

/**
* Login Dialogbox
*/
loginDialog: function() {
var loginDIV = layout.getRegion('center').getEl();
var loginiFrame, loginStatus, loginBody, curShim;
if (loginDIV != null) {
curShim = Ext.useShims;
Ext.useShims = true;
var dialog1 = new Ext.BasicDialog('loginDlg', {
autoCreate: true,
buttonAlign: 'center',
autoTabs: false,
width: 500,
draggable: false,
resizable : false,
height: 200,
shadow:true,
shim: true,
modal: true,
fixedcenter: true,
syncHeightBeforeShow: true
});

Ext.useShims = false;
dialog1.body.applyStyles({background:'transparent',border: 0});
Ext.DomHelper.append(dialog1.body.id, {tag: 'img', src: productLogo});
Ext.DomHelper.append(dialog1.body.id, {tag: 'div', id: dialog1.body.id+ 'ContentForm'});
loginStatus = Ext.DomHelper.append(dialog1.body.id, {tag: 'div', id: dialog1.body.id+ 'ContentFormStatus'});

var fs = new Ext.form.Form({
id: 'loginForm',
method: 'POST',
labelAlign: 'right',
labelWidth: 75
});
Ext.form.Field.prototype.msgTarget = 'under';

fs.fieldset(
{legend:'Login Details'},
new Ext.form.TextField({
fieldLabel: 'User Name',
name: 'username',
allowBlank: false,
width:190
}),
new Ext.form.TextField({
fieldLabel: 'Password',
name: 'password',
inputType: 'password',
allowBlank: false,
width:190
})
);
var loginBtn = dialog1.addButton('Login', this.loginSubmit.createDelegate(fs, [loginStatus]));

fs.render(dialog1.body.id+ 'ContentForm');
dialog1.show ();
dialog1.addKeyListener(13, this.loginSubmit.createDelegate(fs, [loginStatus]));
dialog1.setDefaultButton(loginBtn);
fs.findField('username').focus();
}
},

/**
* Login has been submitted
*/
loginSubmit: function(pLoginStatus) {
if (this.isValid()) {
var vals = this.getValues(true);
var con = new Ext.data.Connection();
con.request({
url: '?Login',
method: 'POST',
params: this.getValues(),
callback: Login.loginCB.createDelegate(pLoginStatus)
});
}
}
}