How can I force a field to be required if another field has a certain value? I have two fields, a select list of checkboxes and a taxonomy term reference.  I would like the taxonomy term reference to be optional unless one of the checkboxes has a certain value, in which case a value must be entered into the taxonomy term reference field.

Is there a module that can accomplish this?  I tried the Field Validation module but I couldn't find a way to configure it for this use case.  Custom code is fine too if you could point me in the right direction.
With custom code you can do something like this:

add a new validation function using hook_form_alter()

your_module_form_alter($form, $form_state, $form_id) {
  if($form_id == 'the_form_ID') {
    $form['#validate'][] = 'your_custom_validation_function';
  }
}


then check to see if the conditions are met

function your_custom_validation_function($form, &amp;$form_state){
  if( $form_state['values']['your_checkbox_name'] == 1 ) {
    // check to see if tags are set
    // use form_set_error('tags_field_id', 'error message') to set a error message
  }
}