You are here

function ajax_command_update_build_id in Drupal 7

Creates a Drupal Ajax 'update_build_id' command.

This command updates the value of a hidden form_build_id input element on a form. It requires the form passed in to have keys for both the old build ID in #build_id_old and the new build ID in #build_id.

The primary use case for this Ajax command is to serve a new build ID to a form served from the cache to an anonymous user, preventing one anonymous user from accessing the form state of another anonymous users on Ajax enabled forms.

Parameters

$form: The form array representing the form whose build ID should be updated.

Related topics

1 call to ajax_command_update_build_id()
ajax_get_form in includes/ajax.inc
Gets a form submitted via #ajax during an Ajax callback.

File

includes/ajax.inc, line 1289
Functions for use with Drupal's Ajax framework.

Code

function ajax_command_update_build_id($form) {
  return array(
    'command' => 'updateBuildId',
    'old' => $form['#build_id_old'],
    'new' => $form['#build_id'],
  );
}