You are here

function farm_livestock_weight_asset_form_validate in farmOS 7

Validate handler for processing the animal weight field.

Parameters

array $form: The form array.

array $form_state: The form state array.

1 string reference to 'farm_livestock_weight_asset_form_validate'
farm_livestock_weight_form_farm_asset_form_alter in modules/farm/farm_livestock/farm_livestock_weight/farm_livestock_weight.module
Implements hook_form_FORM_ID_alter().

File

modules/farm/farm_livestock/farm_livestock_weight/farm_livestock_weight.module, line 928
Farm livestock weight module.

Code

function farm_livestock_weight_asset_form_validate(array $form, array &$form_state) {

  // If units are set, but not weight, show an error.
  if (empty($form_state['values']['weight']['value']) && !empty($form_state['values']['weight']['units'])) {
    form_set_error('weight][value', t('Both weight and units must be specified.'));
  }
}