2011-06-17 149 views
0

我想獲得sencha觸摸中的表單元素的值。我正在使用Sencha觸摸radiofield值

fields = form.getFields(); var name = fields [「name」]。getValue();

這適用於我的大部分領域,但不適用於我的單選按鈕領域。 我正在使用具有男性或女性值的具有「性別」相同名稱的兩個無線電字段。我爲這個字段嘗試了上面的代碼,但是我得到一個錯誤,那就是radiofield沒有方法getValue()。但是,在Ext.form.radio下的sencha touch文檔中,它說收音機確實有這個方法。獲得無線電組的價值的正確方法是什麼?

+0

您是否嘗試過通過一個記錄插入到表單中,然後調用this.updateRecord(this.record)。使用這種方法,您將能夠利用模型的加載和存儲功能,同時還能夠輕鬆提取表單值。 http://dev.sencha.com/deploy/touch/docs/?class=Ext.form.FormPanel http://dev.sencha.com/deploy/touch/docs/source/FormPanel.html#method -Ext.form.FormPanel-updateRecord – Ballsacian1

回答

0

嘗試

var fields = form.getValues(); 
console.log(fields['name']);