EXT form prompt Method

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.