==========
each_field
==========

.. js:function:: each_field(function(field))

**domain**: client 

**language**: javascript

**class** :doc:`Item class </refs/client/item_api>`

Description
===========

Use each_field method to iterate over 
:doc:`fields <at_fields>`
owned by an item.

The each_field() method specifies a function to run for each field (the current
field is passed as a parameter).

You can break the each_field loop at a particular iteration by making the callback 
function return ``false``. 

Example
=======

.. code-block:: js

    function customer_fields(customers) {
        customers.open({limit: 1});
        customers.each_field(function(f) {
            console.log(f.field_caption, f.display_text);
        });
    }    
    
:doc:`Fields </programming/data/fields>`    

:doc:`Field class </refs/client/field_api>`



