View Full Version : Helper text next to form fields

17 Sep 2009, 9:02 AM

I want to have 'helper' text next to form fields, ie

Username: [form entry field] Must be at least 6 characters or numbers

Is there a way to do that in my textfield definition? I could not find a way in the documentation..

I have worked around it by creating a 2 column panel, with a textfield and label, as shown below. However, it is using a different font for the textfield and label.

I can fix it by uncommenting out the "style" statement, but why do I need it? Why doesn't it default to the same style as the rest of the form?

If I have to specify the style for the textfield, how can I specify it to be .x-form-field rather than the specific font/size/etc?? None of the 'cls' parameters seems to have any effect on the textfield.


* Ext JS Library 3.0.0
* Copyright(c) 2006-2009 Ext JS, LLC
* [email protected]
* http://www.extjs.com/license
var username = { xtype: 'textfield',
fieldLabel: 'Username'};
var usernametext = { xtype: 'label',
// style: 'font:normal 12px tahoma, arial, helvetica, sans-serif',
text:'(Username must be at least 6 characters, combination of letters and numbers)' };

var my_panel = new Ext.FormPanel ({
layout: 'column',
renderTo: document.body,
bodyStyle:'padding:5px 5px 0',
layoutConfig: {
columns: 2
defaults: {
border: false,
layout: 'form',
items: [{
items: username
}, {
items: usernametext
}] });

17 Sep 2009, 9:42 AM
Write a plugin similar to http://www.extjs.com/forum/showthread.php?t=77984

17 Sep 2009, 10:24 AM
OK - that's cool - got it to work under or over... But I am kinda new here... How can I make it on the same line as the field??


17 Sep 2009, 10:46 AM
Nothing to do with "new". You understand HTML?