=============
append_record
=============

.. js:function:: append_record(container) 

**domain**: client 

**language**: javascript

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

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

Open a new, empty record at the end of the dataset and creates an 
:doc:`edit_form <at_edit_form>`
for visuall editing of the record.

If ``container`` parameter (Jquery object of the DOM element) is specified the
edit form html template is inserted in the container.

If ``container`` parameter is not specified but **Modeless form** attribute is 
set in the 
:doc:`Edit Form Dialog </admin/items/edit_form_dialog>` or modeless attribute 
of the 
:doc:`edit_options <at_edit_options>` is set programmatically and task has the
:doc:`forms_in_tabs </refs/client/task/at_forms_in_tabs>`
attribute set and the application doesn't have modal forms, the 
modeless edit form will be created in the new tab of the
:doc:`forms_container </refs/client/task/at_forms_container>` object of the task.

In all other cases the modal form will be created.

If adding of a record is allowed in modeless mode, the application calls the 
:doc:`copy <m_copy>`
method to create a copy of the item. This copy will be used to append the record. 

The ``append_record`` method 

* calls the 
  :doc:`can_create <m_can_create>`
  method to check whether a user have a right to append a record, and if not,
  returns
  
* checks whether the item is in edit or insert 
  :doc:`state <at_item_state>`
  , and if not, calls the 
  :doc:`append <m_append>`
  method to append a record
  
* calls the
  :doc:`create_edit_form <m_create_edit_form>`
  method to create a form for visuall editing of the record

See also
========

:doc:`Modifying datasets </programming/data/modifying_datasets>`

:doc:`append <m_append>`

:doc:`can_create <m_can_create>`
