PDA

View Full Version : There's no xtype for a link (anchor)?!?



alphadogg
12 Nov 2010, 5:22 AM
Okay, so we built a FormPanel with a the following items:



var formLogin = new Ext.FormPanel({
labelWidth: 75,
url: '/user/login',
standardSubmit: true,
frame: true,
bodyStyle: 'padding:10px',
layout: 'form',
border: false,
defaults: {
xtype: 'textfield'
},
items: [
{
fieldLabel: 'User Name',
id: 'userName'
},
{
fieldLabel: 'Password',
id: 'password',
inputType: 'password',
listeners: {
specialkey: function(field, e) {
if (e.getKey() == e.ENTER) {
var form = field.ownerCt.getForm();
form.submit();
}
}
}
},
{
xtype: 'label',
fieldLabel: '<a href="#">Label</a>',
listeners: {
render: function(c) {
var label = c.getEl().up('.x-form-item').child('.x-form-item-label');
label.dom.htmlFor = '';
var a = label.child('a');
a.on('click', function() {
Ext.Msg.alert('Alert', 'Anchor clicked');
}, c, { stopEvent: true });
}
}
}
],
buttonAlign: 'center',
buttons: [
{
text: 'Login',
handler: function() {
formLogin.getForm().submit();
}
}
]
});

var formContainer = new Ext.Panel({
layout: 'hbox',
title: 'Welcome to MyForcura',
headerCfg: { cls: 'cpop-home-index-headerCenter' },
border: false,
bodyStyle: 'padding:20px;',
layoutConfig: {
align: 'top',
pack: 'center'
},
items: [
formLogin
]
});
I want to add a simple "Forgot Password?" link. Either in the FormPanel, or maybe below it.

But, it seems there is no Component for a link? Or, did I miss it somehow? I futzing with the Ext.form.Label, based on the code I saw from Condor in this forum using Checkbox, but it seems a little over the top, and somehow adds a ":" character to anything in fieldLabel.

alphadogg
12 Nov 2010, 5:25 AM
Sorry. Wrong forum. This should be in the ExtJS forums.