I have a user registration form where the user will enter “Date of Birth”. I want to put validation on date selection as Date can not be greater than today’s date. How N where to put this validation code?

Comments

meenakshi-2’s picture

No Suggestions :(

drupalphp’s picture

put your validation in either
hook_form_validate($form, &$form_state) funtion or
you may also put it in hook_form_submit($form, &$form_state) also

CODE:

function taxonomy_browser_form_validate($form, &$form_state) {
$include_children = $form_state['values']['include_children'];
$tids = _taxonomy_browser_get_tid_list($form_state['values']['taxonomy'], $include_children);
if (empty($tids)) {
form_set_error('taxonomy', t('You must select at least one category in your search.'));
}