You are here

function creditfield_date_validate in Creditfield Form Element 7

Validate callback for credit card expiration date.

Parameters

type $element:

1 string reference to 'creditfield_date_validate'
creditfield_element_info in ./creditfield.module
Implements hook_element_info().

File

./creditfield.module, line 91

Code

function creditfield_date_validate($element) {
  if ($element['#value']['year'] == date('Y', time()) && $element['#value']['month'] < date('m', time())) {
    form_error($element, t('Please enter a valid expiration date.'));
  }
}