=================
on_get_field_text
=================

on_get_field_text(field)

**domain**: client 

**language**: javascript

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

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

Write an ``on_get_field_text`` event handler to perform custom processing for the 
:doc:`display_text </refs/client/field/at_display_text>`
property. If the event handler does not return a value, the application uses
the 
:doc:`display_text </refs/client/field/at_display_text>`
property value to display the field value in the data-aware controls, otherwise 
the returned value will be used.

The ``field`` parameter is the field whose 
:doc:`display_text </refs/client/field/at_display_text>`
is processed. To get the item that owns the field, use the
:doc:`owner </refs/client/field/at_owner>` attribute of the field.



Example
=======

.. code-block:: js

    function on_get_field_text(field) {
        if (field.field_name === 'customer') {
            return field.owner.firstname.lookup_text + ' ' + field.lookup_text;
        }
    }


See also
========

:doc:`Fields </programming/data/fields>`

