============
edit_options
============

.. js:attribute:: edit_options

**domain**: client 

**language**: javascript

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

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

The ``edit_options`` attribute is a set of options that determine how the edit  
form will be displayed on the browser page.

These options are set in the
:doc:`Edit Form Dialog </admin/items/edit_form_dialog>`
in Application Builder.

You can change ``edit options`` in the 
:doc:`on_edit_form_created <on_edit_form_created>`
event handler of the item. See example.

``edit_options`` is an object that has the following attributes:


* ``width`` - the width of the modal form, the default value is 600 px,

* ``title`` - the title of the form, the default value is the value of a
  :doc:`item_caption </refs/client/abstr_item/at_item_caption>`
  attribute,
  
* ``form_border`` - if true, the border will be displayed around the form

* ``form_header`` - if true, the form header will be created and displayed
  containing form title and various buttons

* ``history_button`` - if true and 
  :doc:`saving change history is enabled </admin/saving_history>`, the history 
  button will be displayed in the form header

* ``close_button`` - if true, the close button will be created in the upper-right 
  corner of the form
  
* ``close_on_escape`` - if true, pressing on the Escape key will execute the 
  :doc:`close_edit_form <m_close_edit_form>`
  method to close the form
  
* ``edit_details`` - the list of the detail names, that will be available for 
  editing in the edit form, if edit form template contains the div with class 
  'edit-detail' (the default edit form template have this div)

* ``detail_height`` - the height of the detail desplayed in the view form,
  if not specified the height of the detail table is 200px

* ``fields`` - specify the list of field names that the 
  :doc:`create_inputs <m_create_inputs>`
  method will use, if ``fields`` attribute of its ``options`` parameter is not specified

* ``template_class`` - if specified, the div with this class will be searched in 
  the task 
  :doc:`templates </refs/client/task/at_templates>` 
  attribute and used as a form html template when creating a form
  This attribute must be set before creating the form


Example
=======

.. code-block:: js

    function on_edit_form_created(item) {
        item.edit_options.width = 800;
        item.edit_options.close_on_escape = false;    
    }

See also
========

:doc:`Forms </programming/interface/forms>`

:doc:`create_edit_form <m_create_edit_form>`

:doc:`close_edit_form <m_close_edit_form>`

