Ext.onReady(function(){
	// QuickTips to display error messages next to form fields
	Ext.QuickTips.init();
	
	// Declare a custom VType
	Ext.apply(Ext.form.VTypes, {
		AlphaNum:  function(v) {
			return /[a-z0-9]/i.test(v);
		},
		AlphaNumText: 'Must be an alphanumeric word',
		AlphaNumMask: /[a-z0-9]/i
	});
	
	// Simple form with a text field for demo purpose
	var myForm = new Ext.FormPanel({
		width: 300,		
		renderTo: Ext.getBody(),
		title: '2 secs with vType Demo',
		items: [
			{
				xtype: 'textfield',
				id: 'alphanum',
				fieldLabel: 'AlphaNum',
				vtype: 'AlphaNum'
			}
		],
		buttons: [
			{
				text: 'Submit',
				handler: function() {
					// myForm.getForm().submit();
					Ext.Msg.alert('Action', 'Form submitted');
				}
			}, {
				text: 'Reset',
				handler: function() {
					myForm.getForm().reset();
				}
			}			
		]
	});
});