Stop Ajax Events in Drupal 7 Form -


i'm faced drupal 7 problem , built-in ajax framework. fields registered step step when user fills them , final check made when form submitted (without js time). i'm using #ajax callback every field except submit button:

$form['myfield'] = array(         '#type' => 'textfield',         '#default_value' => 'test',         '#title' => 'test',         '#ajax' => array(             'callback' => '_form_submit_callback',             'wrapper' => 'name-error-icon-container',             'method' => 'html',             'effect' => 'none',             'progress' => array(                 'message' => null,             ),         ) );  //edit: callback asked  function _form_submit_callback($form, &$form_state) {      form_state_values_clean($form_state); //remove unuseful values $form_state['values']         $hash = $form_state['values']['hash'];     $currdata = db_select('my_custom_table', 'rms')         ->condition('hash', $hash)         ->forupdate(true)         ->fields('rms')         ->execute()         ->fetchassoc();     if (is_array($currdata)) {         if ($currdata != $form_state['values']) {             $form_state['values']['updated_at'] = time();              $num_updated = db_update('my_custom_table')                 ->fields($form_state['values'])                 ->condition('hash', $hash)                 ->execute();             }         }     } else {         $form_state['values']['inserted_at'] = $form_state['values']['updated_at'] = time();         db_insert('my_custom_table')             ->fields($form_state['values'])             ->execute();     } } 

this allows me know user , field has been completed.

everything working great until last field. user enters field , changes value. field updated ajax query when user leaves it.

so each time user leaves field, _form_submit_callback function invoked , content updated.

the problem comes when user clicks submit form button. 2 update queries sent, 1 ajax leaving field , 1 form submit function.

how prevent drupal sending ajax queries when click submit button ? there way remove every single call or disable ajax everywhere ? checked blur, change, focus events nothing working, seems drupal using own events. saw js object in browser called drupal.ajax, maybe can ?

i'm on few days now. i'm exhausted :f if have idea ? thank !


Comments

Popular posts from this blog

python - Specify path of savefig with pylab or matplotlib -

c# - SharpSsh Command Execution -

How to run C# code using mono without Xamarin in Android? -