1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- /*
- * Ext JS Library 2.0 Copyright(c) 2006-2007, Ext JS, LLC. licensing@extjs.com
- *
- * http://extjs.com/license
- */
- Ext.onReady(function() {
- Ext.QuickTips.init();
- // turn on validation errors beside the field globally
- Ext.form.Field.prototype.msgTarget = 'side';
- var bd = Ext.getBody();
- /*
- * ================ Simple form =======================
- */
- bd.createChild({
- tag : 'h2',
- html : 'Form 1 - Very Simple'
- });
- var simple = new Ext.FormPanel({
- labelWidth : 75, // label settings here cascade
- // unless overridden
- url : 'echo.php',
- frame : true,
- title : 'Simple Form',
- bodyStyle : 'padding:5px 5px 0',
- width : 350,
- defaults : {
- width : 230
- },
- defaultType : 'textfield',
- items : [{
- fieldLabel : 'First Name',
- name : 'first',
- allowBlank : true
- }, {
- fieldLabel : 'Last Name',
- name : 'last'
- }, {
- fieldLabel : 'Company',
- name : 'company'
- }, {
- fieldLabel : 'Email',
- name : 'email',
- vtype : 'email'
- }, new Ext.form.TimeField({
- fieldLabel : 'Time',
- name : 'time',
- minValue : '8:00am',
- maxValue : '6:00pm'
- }), {
- xtype : 'sliderfield',
- name : 'slider1',
- minValue : 0,
- maxValue : 100,
- fieldLabel : 'Slider'
- }
- ],
- buttons : [{
- text : 'Save',
- handler : function() {
- simple.getForm().submit({
- success : function(form, action) {
- alert('Success:\n'
- + action.response.responseText);
- },
- failure : function(form, action) {
- alert('Failure: ' + action.failureType);
- }
- });
- }
- }, {
- text : 'Cancel'
- }]
- });
- simple.render(document.body);
- });
|