function form_set_value


Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/
cis7 form_set_value($element, $value, &$form_state)
cle7 form_set_value($element, $value, &$form_state)
elmsmedia7 form_set_value($element, $value, &$form_state)
icor7 form_set_value($element, $value, &$form_state)
meedjum_blog7 form_set_value($element, $value, &$form_state)
mooc7 form_set_value($element, $value, &$form_state)

Changes submitted form values during form validation.

Use this function to change the submitted value of a form element in a form validation function, so that the changed value persists in $form_state through the remaining validation and submission handlers. It does not change the value in $element['#value'], only in $form_state['values'], which is where submitted values are always stored.

Note that form validation functions are specified in the '#validate' component of the form array (the value of $form['#validate'] is an array of validation function names). If the form does not originate in your module, you can implement hook_form_FORM_ID_alter() to add a validation function to $form['#validate'].


$element: The form element that should have its value updated; in most cases you can just pass in the element from the $form array, although the only component that is actually used is '#parents'. If constructing yourself, set $element['#parents'] to be an array giving the path through the form array's keys to the element whose value you want to update. For instance, if you want to update the value of $form['elem1']['elem2'], which should be stored in $form_state['values']['elem1']['elem2'], you would set $element['#parents'] = array('elem1','elem2').

$value: The new value for the form element.

$form_state: Form state array where the value change should be recorded.

Related topics

68 calls to form_set_value()
alpha_theme_settings_validate_not_empty in sites/all/themes/ulmus/omega/alpha/theme-settings.php
Form element validation handler for replacing the value "_none" with NULL.
alpha_theme_settings_validate_primary in sites/all/themes/ulmus/omega/alpha/theme-settings.php
Form element validation handler for validating the primary region setting for zones.
breakpoints_admin_breakpoint_group_import_form_validate in sites/all/modules/local_contrib/breakpoints/
Validate a breakpoint group import.
breakpoints_admin_breakpoint_import_form_validate in sites/all/modules/local_contrib/breakpoints/
Validate a breakpoint import.
ctools_context_entity_settings_form_validate in sites/all/modules/ulmus/ctools/plugins/contexts/
Validate a node.

... See full list


includes/, line 2567
Functions for form and batch generation and processing.


function form_set_value($element, $value, &$form_state) {
  drupal_array_set_nested_value($form_state['values'], $element['#parents'], $value, TRUE);