You are here

function form_set_value in Drupal 4

Same name and namespace in other branches
  1. 5 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

4 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.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.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.

File

includes/form.inc, line 486

Code

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