=================
on_field_get_html
=================

on_field_get_html(field)

**domain**: client 

**language**: javascript

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

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

Write an ``on_field_get_html`` event handler to specify the html that will be 
inserted in the table cell for the field.

If the event handler does not return a value, the application checks if 
the :doc:`on_field_get_text <on_get_field_text>` event handler is defined and it
returns a value, otherwise the :doc:`display_text </refs/client/field/at_display_text>`
property value will be used to display the field value in the cell.

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_field_get_html(field) {
      if (field.field_name === 'total') {
          if (field.value > 10) {
              return '<strong>' + field.display_text + '</strong>';
          }
      }
  }

See also
========

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

:doc:`on_field_get_text <on_get_field_text>`
