views:

389

answers:

1

I have a CCK defined form called 'mytype_node_form'.

I create a module called form_overrides

I create a function called form_overrides_form_alter where I successfully check for $form_id = 'mytype_node_form'

Question:

What should be the name of my validation function (hook_validate) in module form_overrides that would allow me to add custom validation to form mytype_node_form?

I thought it should look something like this

function form_overrides_mytype_node_form_validate($form, &$form_state) or
function form_overrides_validate($form, &$form_state)

A: 

If you don't specify the validation function in $form['#validate'], then Drupal looks for a function named with the form ID plus "_validate". So in this case it would be looking for mytype_node_form_validate() (and similarly mytype_node_form_submit() for the submit function).

flamingLogos