I am using Drupal 7 installation and am using a webform to manage a submission of some data.
The fields are as follows:
I want to be able to allow the form submission based on whether:
What would be the cleanest way of accomplishing this in Drupal 7?
I ended up accomplishing this using hook_form_alter() and a callback function wired to $form['submit']['#validate'][].
function mymodule_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'myform') {
$form['submit']['#validate'][] = 'validation_function';
}
}
function validation_function($form, &$form_state) {
// Validation logic here
// If in validation failed set error message here
}