@@ -47,15 +47,28 @@ function ajax_preprocess_page(&$variables) {
4747 */
4848function ajax_form_alter(&$form, $form_state, $form_id) {
4949 if (array_key_exists('#ajax', $form) && $form['#ajax']) {
50- $found = FALSE;
50+ $found = array('upload' => FALSE, 'submitter' => FALSE) ;
5151 ajax_invoke_alter($form, $form_state, $form_id);
5252 ajax_validator_set($form);
53+ ajax_upload_find($form, $found);
5354 ajax_submitter_find($form, $found);
5455 ajax_submitter_set($form, $found);
5556 }
5657 return TRUE;
5758}
5859
60+ /**
61+ * Finds upload field
62+ *
63+ * @param $form Assoc
64+ * @param $found Assoc
65+ *
66+ */
67+ function ajax_upload_find(&$form, &$found) {
68+
69+ }
70+
71+
5972/**
6073 * Gets internal path from actual url path
6174 *
@@ -114,11 +127,11 @@ function ajax_validator_set(&$form) {
114127 * Sets the submitter
115128 *
116129 * @param $form Assoc
117- * @param $found Bool
130+ * @param $found Assoc
118131 * @return Bool
119132 */
120133function ajax_submitter_set(&$form, $found) {
121- if (!$found) {
134+ if (!$found['submitter'] ) {
122135 $form['#submit'][] = 'ajax_submitter';
123136 $form['#attributes']['class'] = 'ajax-form';
124137 }
@@ -129,7 +142,7 @@ function ajax_submitter_set(&$form, $found) {
129142 * Finds the submitter
130143 *
131144 * @param $form Assoc
132- * @param $found Bool
145+ * @param $found Assoc
133146 * @return Bool
134147 */
135148function ajax_submitter_find(&$form, &$found) {
@@ -145,7 +158,7 @@ function ajax_submitter_find(&$form, &$found) {
145158 if (array_key_exists('#submit', $form[$form_key]) &&
146159 !empty($form[$form_key]['#submit'])) {
147160 $form[$form_key]['#submit'][] = 'ajax_submitter';
148- $found = TRUE;
161+ $found['submitter'] = TRUE;
149162 }
150163 }
151164 //nested
@@ -284,7 +297,7 @@ function ajax_invoke_alter(&$form, &$form_state, $form_id) {
284297 * @return Bool
285298 */
286299function ajax_validator(&$form, &$form_state) {
287- if (array_key_exists('HTTP_X_DRUPAL_AJAX ', $_SERVER )) {
300+ if (array_key_exists('drupal_ajax ', $_REQUEST )) {
288301 drupal_get_messages(NULL, TRUE);
289302 $data = ajax_build(array(
290303 'messages_error' => form_get_errors()
0 commit comments