You are here

function chart_settings_validate in Google Chart Tools: Image Charts 5

Same name and namespace in other branches
  1. 6 chart.module \chart_settings_validate()
  2. 7 chart.module \chart_settings_validate()

Implementation of hook_validate();

File

./chart.module, line 296
Google Charting API. Developed by Tj Holowaychuk

Code

function chart_settings_validate($form_id, $form_values, $form) {
  if (!empty($form_values['chart_global_bg']) && !preg_match('/[a-fA-F0-9]{6}/is', $form_values['chart_global_bg'])) {
    form_set_error('chart_global_bg', t('Invalid color. Formatted as RRGGBB with no pound sign.'));
  }
  if (!empty($form_values['chart_max_width']) && !is_numeric($form_values['chart_max_width'])) {
    form_set_error('chart_max_width', t('Width must be an integer.'));
  }
  if (!empty($form_values['chart_max_height']) && !is_numeric($form_values['chart_max_height'])) {
    form_set_error('chart_max_height', t('Height must be an integer.'));
  }
}