=========
read_only
=========

.. js:attribute:: read_only

**domain**: client 

**language**: javascript

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

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

Read the ``read_only`` property to determines whether the data can be modified in 
data-aware controls.

Set ``read_only`` property to ``true`` to prevent data from being modified in 
data-aware controls.

When you assign a value to the read_only property, the application sets the 
read_only property of all the details and the 
:doc:`read_only </refs/client/field/at_read_only>`
property of each field to that value.

If the user role prohibits editing of the record, ``read_only`` always returns ``true``. 

See also
========

:doc:`read_only </refs/client/field/at_read_only>`

Example
=======

In this example we first set ``read_only`` attribute of the invoices item
to ``true``. It makes all fields and invoice_table detail read only. After that
we allow a user to edit customer field and invoice_table detail.

.. code-block:: js

  function on_edit_form_created(item) {
      item.read_only = true;
      item.customer.read_only = false;
      item.invoice_table.read_only = false;
  }