1.20.x form_test.module form_test_storage_element_validate_value_cached($element, &$form_state)

Form element validation handler for 'value' element in form_test_storage_form().

Tests updating of cached form storage during validation.

File

modules/simpletest/tests/form_test.module, line 886
Helper module for the form API tests.

Code

function form_test_storage_element_validate_value_cached($element, &$form_state) {
  // If caching is enabled and we receive a certain value, change the storage.
  // This presumes that another submitted form value triggers a validation error
  // elsewhere in the form. Form API should still update the cached form storage
  // though.
  if (isset($_REQUEST['cache']) && $form_state['values']['value'] == 'change_title') {
    $form_state['storage']['thing']['changed'] = TRUE;
  }
}