2012-07-26 29 views
0

我正在學習Sencha Touch。我之前使用表單創建了這個應用程序,它工作正常。Sencha Formfields傳遞空字段

現在我正在研究一個新的小測試應用程序,我從另一個應用程序複製代碼,它僅將空變量傳遞給webservice。

查看:

<!-- language: lang-js --> 
    Ext.define('Gasoline.view.InsertTankTrip', { 
requires: [ 
    'Ext.form.FieldSet' 
], 

extend: 'Ext.form.Panel', 
xtype: 'inserttankpanel', 
id: 'insertTankForm', 

config: { 
    title: 'Insert Tank Trip', 
    iconCls: 'add', 
    url: 'contact.php', 
    items:[ 
     { 
      xtype: 'fieldset', 
      title: 'Insert Tank Trip', 
      instructions: '(Make sure the info is correct!)', 


      items:[ 
       { 
        xtype: 'datepickerfield', 
        label: 'Date', 
        name: 'date', 
        value: new Date() 
       }, 
       { 
        xtype: 'textfield', 
        label: 'Amount', 
        name: 'amount', 
        minValue:-9007199254740992, 
        maxValue: 9007199254740992 
       } 
      ] 
     },{ 
      xtype: 'button', 
      text: 'Send', 
      ui: 'confirm', 
      action: 'insertTankSubmit' 

     } 
    ] 
} 
}); 

和Controller:

launch: function() { 
    // Destroy the #appLoadingIndicator element 
    Ext.fly('appLoadingIndicator').destroy(); 

    // Initialize the main view 
    Ext.Viewport.add(Ext.create('Gasoline.view.Main')); 

    this.control({ 
     'button[action=insertTankSubmit]' : { 
      tap: 'insertTankForm' 
     }/*, 
     'list[itemId=kingsLeagueList]' : { 
      itemtap: 'onListTap' 
     }, 
     'list[itemId=tournamentsList]' : { 
      disclose: 'showDetail' 
     }*/ 

    }); 
}, 

insertTankForm : function(){ 
console.log('test'); 
    var form = this.getInsertTankForm(); 

    form.submit({ 
     url:'contact.php' 
    }); 
}, 

這將發送以下的Web服務(目前不存在我只是開發者工具檢查)

date:2012-07-26T17:02:16 amount:

所以日期不會被髮送,數量犯規

如果我在爲被髮送的號碼......標準值填寫,但如果你輸入的東西,但它仍然不會發送

回答

0

我曾嘗試多種解決方案......沒有一次成功。

最後,我刪除了所有的東西......用完全相同的方式編碼了一切,並開始工作...

1

使用

xtype: 'numberfield' 

代替

xtype: 'textfield'