日期:2014-05-16 浏览次数:20492 次
Ext.onReady(function(){ });
var movie_form = new Ext.FormPanel({ url: 'movie‐form‐submit.php', renderTo: document.body, //插入的位置 frame: true, title: 'Movie Information Form', //表格的名称 width: 250, //大小 items: [{ xtype: 'textfield', fieldLabel: 'Title', name: 'title', allowBlank: false //校验是否为空 },{ xtype: 'textfield', //类型 fieldLabel: 'Director', //显示的名称 name: 'director' //传到后台变量的名称 },{ xtype: 'datefield', fieldLabel: 'Released', name: 'released' }] }); });
Ext.form.VTypes['nameVal'] = /^[A‐Z][A‐Za‐z\‐]+[A‐Z][A‐Za‐z\‐]+$/; Ext.form.VTypes['nameMask'] = /[A‐Za‐z\‐ ]/; Ext.form.VTypes['nameText'] = 'In‐valid Director Name.'; Ext.form.VTypes['name'] = function(v){ return Ext.form.VTypes['nameVal'].test(v); }
{ xtype: 'checkbox', fieldLabel: 'Bad Movie', name: 'bad_movie' }
{ xtype: 'radio', fieldLabel: 'Filmed In', name: 'filmed_in', boxLabel: 'Color' },{ xtype: 'radio', hideLabel: false, labelSeparator: '', name: 'filmed_in', boxLabel: 'Black & White' }
1.var genres = new Ext.data.SimpleStore({ fields: ['id', 'genre'], data : [['1','Comedy'],['2','Drama'],['3','Action']] }); 2.{ xtype: 'combo', name: 'genre', fieldLabel: 'Genre', mode: 'local', //当地的,数据一般不发生变动的. store: genres, //名称一致 displayField:'genre', width: 120 }
{ xtype: 'textarea', name: 'description', hideLabel: true, labelSeparator: '', //清除了标签分隔符 height: 100, anchor: '100%' }
{ xtype: 'htmleditor', name: 'description', hideLabel: true, labelSeparator: '', height: 100, anchor: '100%' }
{ xtype: 'textfield', fieldLabel: 'Title', name: 'title', allowBlank: false, listeners: { specialkey: function(f,e){ if (e.getKey() == e.ENTER) { } } } movie_form.getForm().submit(); }
buttons: [{ text: 'Save', handler: function(){ movie_form.getForm().submit({ success: function(f,a){ Ext.Msg.alert('Success', 'It worked'); }, failure: function(f,a){ Ext.Msg.alert('Warning', 'Error'); } }); } }, { text: 'Reset', handler: function(){ movie_form.getForm().reset(); } }]