I have a function:
function mymodule_validate_ubercart_checkout($form, &$form_state)
{
$allOtherValidatorsPassed = hasAllValidated();
if ($allOtherValidatorsPassed)
{
// Only now do I do my actual check...
if (empty($creditCardDetails)) form_set_error('myfield',
t('Invalid credit card details entered. Please try again.')
);
}
}
So basically I need to know how to do the hasAllValidated function. I just want my actual validation to happen if all other validations prior to this one has passed.
How do I do that? I can't seem to find where validation errors are stored so I can check this?
I think you can use the form_get_errors function to check if the validations were success before your function.
https://api.drupal.org/api/drupal/includes!form.inc/function/form_get_errors/7
function mymodule_validate_ubercart_checkout($form, &$form_state)
{
$allOtherValidatorsPassed = form_get_errors();
if (empty($allOtherValidatorsPassed))
{
// Only now do I do my actual check...
if (empty($creditCardDetails)) form_set_error('myfield',
t('Invalid credit card details entered. Please try again.')
);
}
}