Hybrid View
-
18 Aug 2009 11:40 AM #1
Field help text plugin.
Field help text plugin.
A very simple plugin inspired by http://extjs.com/forum/showthread.php?t=33162
It appends a help message above or below a Field.
eg:

CSS:Code:Ext.ux.FieldHelp = Ext.extend(Object, (function(){ function syncInputSize(w, h) { this.el.setSize(w, h); } function afterFieldRender() { if (!this.wrap) { this.wrap = this.el.wrap({cls: 'x-form-field-wrap'}); this.positionEl = this.resizeEl = this.wrap; this.actionMode = 'wrap'; this.onResize = this.onResize.createSequence(syncInputSize); } this.wrap[this.helpAlign == 'top' ? 'insertFirst' : 'createChild']({ cls: 'x-form-helptext', html: this.helpText }); } return { constructor: function(t, align) { this.helpText = t; this.align = align; }, init: function(f) { f.helpAlign = this.align; f.helpText = this.helpText; f.afterRender = f.afterRender.createSequence(afterFieldRender); } }; })());
Code:.x-form-helptext { font-size: 9px; color: #888; }Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
19 Aug 2009 5:08 AM #2
How do i apply this to a text box, do i have to create a FieldHelp object and then add it to my textfield, or is there a property i can set on my textfield (i tried both fieldHelp and helptext as properties)
-
19 Aug 2009 5:52 AM #3
It's a plugin. You use it in the standard way plugins are used: In the plugins config.
Code:plugins: [ new Ext.ux.FieldHelp('Some help text') ],Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
19 Aug 2009 6:31 AM #4
Thanks, I guess i don't know the difference between an extension and a plugin.
It looks nice - just what I was looking for
-
20 Aug 2009 4:21 AM #5Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28
Nige!! this should be in the framework.

MH61, an "extension" extends an Ext JS class.
a "Plugin" generally extends Object (or observable in some cases) and is utilized by an Ext JS class. I'm going to be adding a chapter dedicated to extensions and plugins in Ext JS in Action

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
20 Aug 2009 4:37 AM #6
Hi,
Is not the same effect that??:
Greetings,PHP Code:Ext.form.Field.prototype.msgTarget = 'under';
-
20 Jan 2010 12:58 PM #7
Give your x-form-helptext class a padding-left enough to clear your icon, and a non-repeating background-image of your choice.
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
20 Jan 2010 2:06 PM #8
Thank you very much for your prompt response. I'll give it a try and report back.
-
21 Jan 2010 1:30 AM #9
and image help text ;-)
Code:Ext.ux.FieldHelp = Ext.extend(Object, (function(){ function afterFieldRender() { if (this.helpText) { if (this.getEl().up('div.x-form-item')) { var helpImage = this.getEl().up('div.x-form-item').child('label').createChild({ tag: 'img', src: '../media/ico/help.png', style: 'margin-bottom:0px; margin-left:5px; padding:0px;' }); Ext.QuickTips.register({ target: helpImage, title: '', text: this.helpText, enabled: true }); } } } return { constructor: function(t) { this.helpText = t; }, init: function(f) { f.helpText = this.helpText; f.afterRender = f.afterRender.createSequence(afterFieldRender); } }; })());
-
21 Jan 2010 4:01 AM #10
You need to look at your source for ComboBox.js, and add an override based on http://www.extjs.com/forum/showthrea...489#post377489
That fix is applied in SVN and will be available in 3.1.1Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642


Reply With Quote