沉睡森林@漂在北京

          本處文章除注明“轉載”外均為原創,轉載請注明出處。

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            152 隨筆 :: 4 文章 :: 114 評論 :: 0 Trackbacks

          在對extform進行布局處理后,發現不能提交textfield的值到服務器上面。代碼只能提交params里面的一個參數,其他的field不能提交。下面的代碼是布局后的代碼:

          <html>

          <head>

          <link rel="stylesheet" type="text/css" href="http://127.0.0.1:8080/greatwall/script/ext/resources/css/ext-all.css" />

          <script type="text/javascript" src="http://127.0.0.1:8080/greatwall/script/ext/ext-base.js"></script>

          <script type="text/javascript" src="http://127.0.0.1:8080/greatwall/script/ext/ext-all.js"></script>

          <script type="text/javascript" src="http://127.0.0.1:8080/greatwall/script/ext/ext-lang-zh_CN.js"></script>

          <title>Example of Form Demo</title>

          </head>

          <script>

          function func_submit_click(){

              testForm.form.doAction("submit",{

                 method:'post',

                 url : 'http://127.0.0.1:8080/greatwall/txn990051.do',

                 success:function(form,action){ 

                     Ext.Msg.alert('add', 'success22222222222');

                 },

                 failure:function(form,action){

                     Ext.Msg.alert('add', 'success2222222222222222222222222');

                 },

                 params : { action : 'submit', qq : '233298765' }

              });   

          }

          </script>

          <body>

          <script>

          var testForm = null;

          Ext.BLANK_IMAGE_URL = 'http://127.0.0.1:8080/greatwall/script/ext/resources/images/default/s.gif';

          var _bodyWidth = Ext.getBody().getWidth()-12;

          Ext.onReady(function(){

              Ext.QuickTips.init();

              Ext.form.Field.prototype.msgTarget = 'qtip';

              testForm = new Ext.FormPanel({name:'testForm',id:'testForm',layout:'table',style:'height:100%',width:_bodyWidth+12,layoutConfig: {columns:4},defaults:{border:false,layout:'form',frame:false,labelAlign:'right',labelWidth:75,width:_bodyWidth/2,height:30}, method:'post',src:'txn990042.do',title:'testForm',frame:true});

              testForm.addButton({text:'submit',name:'button_submit',handler:func_submit_click});

              testForm.add({colspan:2,width:_bodyWidth/2.0,items:{xtype:'textfield',fieldLabel:'username',name:'username',anchor:'100%'}});

              testForm.add({colspan:2,width:_bodyWidth/2.0,items:{xtype:'textfield',fieldLabel:'email',name:'email',anchor:'100%'}});

              testForm.add({colspan:2,width:_bodyWidth/2.0,items:{xtype:'textfield',fieldLabel:'qq',name:'qq',anchor:'100%'}});

              testForm.add({colspan:2,width:_bodyWidth/2.0,items:{xtype:'textfield',fieldLabel:'msn',name:'msn',anchor:'100%'}});

              testForm.render(Ext.getBody());

          });

          </script>

          </body>

          </html>

           

              而使用下面的代碼是可以提交到服務器上面的:

          <html>

          <head>

          <link rel="stylesheet" type="text/css" href="http://127.0.0.1:8080/greatwall/script/ext/resources/css/ext-all.css" />

          <script type="text/javascript" src="http://127.0.0.1:8080/greatwall/script/ext/ext-base.js"></script>

          <script type="text/javascript" src="http://127.0.0.1:8080/greatwall/script/ext/ext-all.js"></script>

          <script type="text/javascript" src="http://127.0.0.1:8080/greatwall/script/ext/ext-lang-zh_CN.js"></script>

          <title>Example of Form Demo</title>

          </head>

          <script>

          function func_submit(){

              testForm.form.doAction("submit",{

                 method:'post',

                 url : 'http://127.0.0.1:8080/greatwall/txn990051.do',

                 success:function(form,action){ 

                     Ext.Msg.alert('add', 'success22222222222');

                 },

                 failure:function(form,action){

                     Ext.Msg.alert('add', 'success2222222222222222222222222');

                 },

                 params : { action : 'submit', qq : '233298765' }

              });   

          }

          </script>

          <body>

          <script>

          var testForm = null;

          Ext.BLANK_IMAGE_URL = 'http://127.0.0.1:8080/greatwall/script/ext/resources/images/default/s.gif';

          var _bodyWidth = Ext.getBody().getWidth()-12;

          Ext.onReady(function(){

              Ext.QuickTips.init();

              Ext.form.Field.prototype.msgTarget = 'qtip';

              testForm = new Ext.FormPanel({

                 name:'testForm',

                 id:'testForm',

                 style:'height:100%',

                 title:'testForm',

                 frame:true

              });

              testForm.add({fieldLabel:'username',name:'username',xtype:'textfield'});

              testForm.add({fieldLabel:'email',name:'email',xtype:'textfield'});

              testForm.add({fieldLabel:'msn',name:'msn',xtype:'textfield'});

              testForm.addButton({text:'submit',handler:func_submit});

              testForm.render(Ext.getBody());

          });

          </script>

          </body>

          </html>

           

              對于表單肯定是需要進行布局處理的,數據提交肯定是可以滿足的,但是對于ext來說,怎么樣才算是創建了一個html的表單?是FormPanel還是layoutform的?感覺第一段代碼是不是添加了多個form在一個大的form里面了,到底ext是怎么處理的,還需要研究研究。

           

          posted on 2008-11-13 17:22 王總兵 閱讀(635) 評論(0)  編輯  收藏 所屬分類: Ext
          主站蜘蛛池模板: 安平县| 临猗县| 格尔木市| 凤山市| 开化县| 分宜县| 美姑县| 西平县| 北票市| 嘉义市| 济源市| 青河县| 寻乌县| 遵义县| 文安县| 桐庐县| 岑溪市| 谢通门县| 宁河县| 翼城县| 浮山县| 逊克县| 舒兰市| 东丰县| 红桥区| 普兰县| 广河县| 萨迦县| 澄迈县| 定南县| 广灵县| 千阳县| 宁乡县| 石家庄市| 潞西市| 勃利县| 榕江县| 涞源县| 西平县| 贡山| 启东市|