EXT form prompt mode: msgtarget: 4 moderate mode: QTip, title, under, side
Ext. onready (function (){
Ext. blank_image_url = "Resources/images/default/s.gif ";
Ext. quicktips. INIT (); // a prompt is displayed during initialization. No message is prompted.
VaR form = new Ext. Form. formpanel ({
Title: "prompt message (side )",
Height: 200,
Width: 300,
Frame: True,
Labelseparator :":",
Labelwidth: 60,
Labelalign: "right ",
Items :[
New Ext. Form. textfield ({
Fieldlabel: "name ",
Allowblank: false,
Blanktext: "enter a name ",
Msgtarget: "QTip" // modify the value msgtarget: "title" msgtarget: "under" msgtarget: "side"
}),
New Ext. Form. numberfield ({
Fieldlabel: "Age ",
Allowblank: false,
Blanktext: "Please write age ",
Msgtarget: "QTip"
})
]
});
New Ext. viewport ({
Title :"",
Items: [Form]
});
});
When using under, pay attention to the height of the form. If the height is not enough, the following situations may occur:
Figure
When using side, pay attention to the width of the form. If the width is insufficient, the following situations may occur:
Figure
Adding a prompt to each field is cumbersome,
Add Ext. Form. Field. Prototype. msgtarget = "under"; // Title, QTip, side under Ext. quicktips. INIT ();
You can achieve a unified prompt.
**************************************** *******************
※Ext. Form. textfield ※
Ext. onready (function (){
Ext. quicktips. INIT ();
Ext. Form. Field. Prototype. msgtarget = "side ";
VaR form = new Ext. Form. formpanel ({
Title: "Ext. Form. formpanel example ",
Labelseparator :":",
Labelwidth: 60,
Bodystyle: "padding: 5 5 5 5 ",
Frame: True,
Height: 120,
Width: 250,
Items :[
New Ext. Form. textfield ({
Fieldlabel: "User Name ",
ID: "username ",
Selectonfocus: True, // The text is automatically selected when the focus is obtained.
Allowblank: false,
RegEx:/^ ([\ W] + )(. [\ W] +) * @ ([\ W-] + \.) {1, 5} ([A-Za-Z]) {2, 4} $ /,
Regextext: "Incorrect username format"
}),
New Ext. Form. textfield ({
Fieldlabel: "password ",
Inputtype: "password ",
Allowblank: false
})
]
});
New Ext. viewport ({
Title :"",
Items: [Form]
});
});
The authentication username must be in the email format. Verify whether it is null, and then verify the format.
[Attachimg] 100 [/attachimg]
**************************************** *******************
※Ext. Form. textarea ※
Ext. onready (function (){
Ext. quicktips. INIT ();
VaR form = new Ext. Form. formpanel ({
Title: "Ext. Form. textarea example ",
Labelseparator :":",
Labelwidth: 60,
Bodystyle: "padding: 5 5 5 5 ",
Frame: True,
Height: 150,
Width: 250,
Items :[
New Ext. Form. textarea ({
ID: "memo ",
Width: 150,
Fieldlabel: "Remarks"
})
],
Buttons: [{text: "OK", Handler: showvalue}]
});
Function showvalue (){
VaR memo = form. findbyid ("memo"); // obtain the input control
Alert (memo. getvalue (); // get the Space Value
};
New Ext. viewport ({
Title :"",
Items: [Form]
});
});
[Attachimg] 101 [/attachimg]
**************************************** *******************
※Ext. Form. numberfield ※
Ext. onready (function (){
Ext. quicktips. INIT ();
Ext. Form. Field. Prototype. msgtarget = "side ";
VaR form = new Ext. Form. formpanel ({
Title: "Ext. Form. numberfield example ",
Labelseparator :":",
Labelwidth: 60,
Bodystyle: "padding: 5 5 5 5 ",
Frame: True,
Height: 150,
Width: 250,
Items :[
New Ext. Form. numberfield ({
Fieldlabel: "integer ",
Allowdecimals: false, // decimals cannot be input
Nantext: "Please enter a valid number", // the error message is invalid.
Allownegative: false // negative numbers cannot be entered
}),
New Ext. Form. numberfield ({
Fieldlabel: "decimal ",
Decimalprecision: 2, // exact to 2 digits after the decimal point
Allowdecimals: True,
Nantext: "enter a valid number ",
Allownegative: false
}),
New Ext. Form. numberfield ({
Fieldlabel: "Number Limit ",
Basechars: "12345" // input number range
}),
New Ext. Form. numberfield ({
Fieldlabel: "numerical limit ",
Maxvalue: 100, // maximum value
Minvalue: 50 // minimum
})
]
});
New Ext. viewport ({
Title :"",
Items: [Form]
});
});
Decimalprecision is rounded down. When two decimal places are retained, the value is 14.23545. After the focus is removed, the value becomes 14.24.