views:

651

answers:

2

Hello. 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 their values.

How can I do this ?

Thank you!

A: 

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

ExtJS forum

Upper Stage
Thank you, but I forgot to specify that those are not the only fields from the form. I got many other fields so I need to grab those by the name.
Manny Calavera
Could you iterate over all fields, check the name, and ignore those that are not interesting?
Upper Stage
If not, then I suggest you query your form using a CSS selector.
Upper Stage
+2  A: 

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[]');
Joel Mueller