I'm using Drupal 7 field API to reload part of my form through AJAX. I have a button which makes the call but I would like to remove it and make the call programmatically as a response to a specific event. Here is my code for the AJAX button:
$form['documents']['reload_document_list_button'] = array(
'#type' => 'button',
'#value' => 'Обновить список документов',
'#ajax' => array(
'callback' => 'reload_document_list',
'wrapper' => 'document-list',
'method' => 'replace',
),
);
(See http://api.drupal.org/api/drupal/developer!topics!forms_api_reference.html/7#ajax for details.) Is there a way to do this?
P.S. I know I can style the button to make it invisible and trigger 'click' event, but I am looking for a neater way to do this.