Are you interested in implementing custom validation for a CCK field?
If so, you can achieve this by developing a module and utilizing the hook_form_alter() function to create your own validation process.
function mymodule_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'story_node_form': // Customize based on your content type
// Add a link validate handler for additional validation.
$form['#validate'][] = 'mymodule_field_validate';
break;
}
}
function mymodule_field_validate($form, &$form_state) {
if (!somevalidatorfunctionorother($form_state['values']['my_custom_field']) {
form_set_error('my_custom_field', t('Your error message here.'));
}
}
The code snippet above was inspired by a post found at: