You are here

function mathfield_validate_expression in Math Field 7

Element validate callback to populate the list of dependent fields.

1 string reference to 'mathfield_validate_expression'
mathfield_field_settings_form in ./mathfield.module
Implements hook_field_settings_form().

File

./mathfield.module, line 85
Adds a dynamic math expression field.

Code

function mathfield_validate_expression($element, &$form_state) {
  $dependencies = array();
  $expression = $form_state['values']['field']['settings']['expression'];
  $tokens = _mathfield_extract_tokens($expression);
  foreach ($tokens as $info) {
    $dependencies[] = $info['field_name'];
  }
  form_set_value($element, $dependencies, $form_state);
}