Browse Source

Add a hidden next button at the top of the form so that it becomes the first button triggered if a user submits the form with the enter key.

pull/562/head
Matthew Perry 10 years ago
parent
commit
1316c9a384
  1. 8
      includes/ingest.form.inc

8
includes/ingest.form.inc

@ -499,6 +499,14 @@ function islandora_ingest_form_stepify(array $form, array &$form_state, array $s
);
$form['prev'] = $first_form_step ? NULL : islandora_ingest_form_previous_button($form_state);
$form['next'] = $last_form_step ? islandora_ingest_form_ingest_button($form_state) : islandora_ingest_form_next_button($form_state);
// Duplicate next button and hide it at the top of the form so that the form
// always triggers "next" if the user submits the form with the enter key.
if (!is_null($form['prev'])) {
$form['hidden_next'] = $form['next'];
$form['hidden_next']['#weight'] = -99;
$form['hidden_next']['#prefix'] = '<div style="display:none;">';
$form['hidden_next']['#suffix'] = '</div>';
}
// Allow for a hook_form_FORM_ID_alter().
drupal_alter(array('form_' . $step['form_id'], 'form'), $form, $form_state, $step['form_id']);
return $form;

Loading…
Cancel
Save