You are here

function form_set_value in Drupal 5

Same name and namespace in other branches
  1. 4 includes/form.inc \form_set_value()
  2. 6 includes/form.inc \form_set_value()
  3. 7 includes/form.inc \form_set_value()

Use this function to make changes to form values in the form validate phase, so they will be available in the submit phase in $form_values.

Specifically, if $form['#parents'] is array('foo', 'bar') and $value is 'baz' then this function will make $form_values['foo']['bar'] to be 'baz'.

Parameters

$form: The form item. Keys used: #parents, #value

$value: The value for the form item.

Related topics

6 calls to form_set_value()
form_builder in includes/form.inc
Adds some required properties to each form element, which are used internally in the form API. This function also automatically assigns the value property from the $edit array, provided the element doesn't already have an assigned value.
node_search_validate in modules/node/node.module
Form API callback for the search form. Registered in node_form_alter().
password_confirm_validate in includes/form.inc
Validate password_confirm element.
search_form_validate in modules/search/search.module
As the search form collates keys from other modules hooked in via hook_form_alter, the validation takes place in _submit. search_form_validate() is used solely to set the 'processed_keys' form value for the basic search form.
user_pass_validate in modules/user/user.module

... See full list

File

includes/form.inc, line 840

Code

function form_set_value($form, $value) {
  global $form_values;
  _form_set_value($form_values, $form, $form['#parents'], $value);
}