开发者

ExtJS loop through form fields that got a specified name

I'm using ExtJS 3. I have a formPanel with many "cloned" fields and I gave every field the name "price[]". After submit I would like to loop through every field that has the name "price[]" and get their values one at a time to be checked against something in the database.

Note: there are other fields in this form so that's why I need to specify witch items to get from it, by name. I know how to submit the form, I just need to loop through those field and get th开发者_Python百科eir values.

How can I do this ?

Thank you!


You can use the find(propName, value) method of FormPanel. It returns an array of all the matches. The matches will be Ext.form.WhateverField objects, depending on what types of input elements your form has, and not raw DOM elements.

var priceFields = myFormPanel.find('name', 'price[]');


The BasicForm object has a property items: it is a mixed collection. You may iterate over the collection.

ExtJS forum

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜