function tripal_db_edit_form_ajax

2.x tripal_db.admin.inc tripal_db_edit_form_ajax($form, $form_state)

Ajax callback for the tripal_db_form

Related topics

1 string reference to 'tripal_db_edit_form_ajax'
tripal_db_db_edit_form in tripal_db/includes/tripal_db.admin.inc
Form to edit existing databases. Implements hook_form().

File

tripal_db/includes/tripal_db.admin.inc, line 312
Provide administration of dbs & dbxrefs

Code

function tripal_db_edit_form_ajax($form, $form_state) {

  $elements = array();

  // add in the form fields and the buttons
  if (array_key_exists('dbid', $form_state['values'])) {
    $elements['fields'] = $form['fields'];
    $elements['update'] = $form['update'];
    $elements['delete'] = $form['delete'];
  }

  // add back in the db-edit-div that is used for the next round of AJAX
  $elements['fields']['#prefix'] = '<div id="db-edit-div">';
  $elements['fields']['#suffix'] = '</div">';

  // reset the values for the fields to the defaults
  $elements['fields']['name']['#value'] = $elements['fields']['name']['#default_value'];
  $elements['fields']['description']['#value'] = $elements['fields']['description']['#default_value'];
  $elements['fields']['url']['#value'] = $elements['fields']['url']['#default_value'];
  $elements['fields']['urlprefix']['#value'] = $elements['fields']['urlprefix']['#default_value'];

  //drupal_set_message('<pre>' . print_r($elements, TRUE) . '</pre>', "status");

  return $elements;
}