I have created my own validate handler:
/**
* Validate handler.
*/
function my_module_validate($form, &$form_state) {
$values = $form_state['values'];
if ($values['type'] == 'line') {
form_set_error('type', t('MY VALIDATION.'));
}
}
which is called from a button element:
'preview' => array(
'#type' => 'button',
'#value' => t('Preview'),
'#validate' => array('my_module_validate'),
'#weight' => 8,
),
which produces this result on submission of an empty form:
The only validation function that I want to run is my own, from my own handler - the last error message - yet all the default validation functions run as well. How do I disable these?
'#required' => TRUE,
from field. Or make itFALSE
.'#required' => TRUE,
will always trigger the default validation.