You are here

function flashnode_validate in Flash Node 5.6

Same name and namespace in other branches
  1. 5.2 flashnode.module \flashnode_validate()
  2. 5.3 flashnode.module \flashnode_validate()
  3. 6.3 flashnode.module \flashnode_validate()
  4. 6.2 flashnode.module \flashnode_validate()

Implementation of hook_validate

File

./flashnode.module, line 211

Code

function flashnode_validate(&$node, $form) {

  // Check if file is empty
  if (empty($form['flashnode']['_flashnode']['#value'])) {
    form_set_error('flashfile', t('You must specify a Flash file to upload.'));
  }

  // Check height is valid (not empty & not numeric)
  if (!is_numeric($form['flashnode']['options']['height']['#value']) && !empty($form['flashnode']['options']['height']['#value'])) {
    form_set_error('flashnode][height', t('You must enter a valid height.'));
  }

  // Check width is valid (not empty & not numeric)
  if (!is_numeric($form['flashnode']['options']['width']['#value']) && !empty($form['flashnode']['options']['width']['#value'])) {
    form_set_error('flashnode][width', t('You must enter a valid width.'));
  }
}