_form_builder_ie_cleanup
includes/form.inc, строка 1094
- Версии
- 6
_form_builder_ie_cleanup($form, &$form_state)
In IE, if only one submit button is present, AND the enter key is
used to submit the form, no form value is sent for it and our normal
button detection code will never detect a match. We call this
function after all other button-detection is complete to check
for the proper conditions, and treat the single button on the form
as 'clicked'
if they are met.
Связанные темы
Код
<?php
function _form_builder_ie_cleanup($form, &$form_state) {
// Quick check to make sure we're always looking at the full form
// and not a sub-element.
if (!empty($form['#type']) && $form['#type'] == 'form') {
// If we haven't recognized a submission yet, and there's a single
// submit button, we know that we've hit the right conditions. Grab
// the first one and treat it as the clicked button.
if (empty($form_state['submitted']) && !empty($form_state['buttons']['submit']) && empty($form_state['buttons']['button'])) {
$button = $form_state['buttons']['submit'][0];
// Set up all the $form_state information that would have been
// populated had the button been recognized earlier.
$form_state['submitted'] = TRUE;
$form_state['submit_handlers'] = empty($button['#submit']) ? NULL : $button['#submit'];
$form_state['validate_handlers'] = empty($button['#validate']) ? NULL : $button['#validate'];
$form_state['values'][$button['#name']] = $button['#value'];
$form_state['clicked_button'] = $button;
}
}
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии