1 ajax.inc ajax_command_update_build_id($form)

Creates a Backdrop 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.

Return value

array: An array with properties to be passed to updateBuildId() in ajax.js.

Related topics

File

core/includes/ajax.inc, line 1498
Functions for use with Backdrop's Ajax framework.

Code

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