-
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,167
- 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 Aug 2009 4:39 AM #7Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,167
- Vote Rating
- 28
That's for error messages though.

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.
-
21 Aug 2009 10:21 AM #8
Hi Animal,
that's a great addition (imho should be in core)
What's about add a property "position" that let render the help text on top or bottom of the field?
From semantic i would like to have it before the field, visual looks nicer after because of Alignement.vg Steffen
--------------------------------------
Release Manager of TYPO3 4.5
energlobe.de - german online magazine
-
21 Aug 2009 10:46 PM #9
Done. The CSS has been updated. clear: both was unnecessary.
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
-
22 Aug 2009 2:58 AM #10
superb, thx!
vg Steffen
--------------------------------------
Release Manager of TYPO3 4.5
energlobe.de - german online magazine


Reply With Quote