On view:
#valueORform_type_ELEMENT_value($element, $edit=FALSE)(convert the incoming#valueor#default_valueinto the internal element structure)#process#after_build
On submit:
#valueORform_type_ELEMENT_value($element, $edit=FALSE)(convert the incoming#valueor#default_valueinto the internal element structure)#process#after_build#element_validate(convert the internal element structure into an externally visible#value-- seepassword_confirm_validate()for an example)
Example of form_type_ELEMENT_value($element, $edit=FALSE):
<?php
function form_type_example_field_value($element, $edit = FALSE) {
if (func_num_args() == 1) {
return $element['#default_value'];
}
}
?>
If you are using form_set_value() to clear sub element values inside the #element_validate function, be sure to clear the sub element values before setting the main element value, or the main element value may get corrupted.
