ExtJS Msgtarget Valid values are:
Qtip: Display a floating prompt message
Title: Display a browser floating prompt message
Under: A prompt message is displayed below the field, and you should pay attention to the height of the form when using under
Side: Displays a prompt message to the right of the field, using side to pay attention to the width of the form
None: No prompt message is displayed
The code is as follows:
1Ext.onready (function(){2Ext.QuickTips.init ();//initializes the display of the prompt message. There is no hint that information will not come out. 3 varform =NewExt.form.FormPanel ({4Title: "Hint Message (side)",5height:200,6width:300,7Frametrue,8Labelseparator: ":",9Labelwidth:60,TenLabelAlign: "Right", One items:[ A NewExt.form.TextField ({ -Fieldlabel: "Name", -Allowblank:false, theBlanktext: "Please enter a name", -Msgtarget: "Qtip"//Modify the value here Msgtarget: "title" Msgtarget: "Under" Msgtarget: "Side" - }), - NewExt.form.NumberField ({ +Fieldlabel: "Age", -Allowblank:false, +Blanktext: "Please write age", AMsgtarget: "Qtip" at }) - ] - }); - NewExt.viewport ({ -Title: "", - Items:[form] in }); -});
Qtip,title,under,side forms of each:
It's cumbersome to add hints to each field,
As long as the Ext.QuickTips.init (), and the next line Ext.form.Field.prototype.msgTarget = "under";//title,qtip,side
Can realize the unified prompt way.
Example of a unified prompt approach :
1Ext.onready (function(){2 Ext.QuickTips.init ();3Ext.form.field.prototype.msgtarget= "Side";4 varform =NewExt.form.FormPanel ({5Title: "Ext.form.FormPanel Example",6Labelseparator: ":",7Labelwidth:60,8Bodystyle: "Padding:5 5 5 5",9Frametrue,Tenheight:120, Onewidth:250, A items:[ - NewExt.form.TextField ({ -Fieldlabel: "User name", theID: "UserName", -Selectonfocus:true,//automatically select text when you get focus -Allowblank:false, -regex:/^ ([\\w]+) (. [ \\w]+) *@ ([\\w-]+\\.) {1,5} ([a-za-z]) {2,4}$/, +Regextext: "User name format error" - }), + NewExt.form.TextField ({ AFieldlabel: "Password", atInputType: "Password", -Allowblank:false - }) - ] - }); - NewExt.viewport ({ inTitle: "", - Items:[form] to }); +});
ExtJS Msgtarget Tip Location