Preventing webform save Goal: Using webform (and it's hooks) in drupal 7 I need to, under certain conditions, avoid saving the form submission (i.e. under those conditions I need to discard the submission instead of saving it to submissions models or, if that's not possible, correctly reference the submission and delete it).  

Question: How is that done? Either of the solutions would be fine for me. I didn't try anything yet, since I have no clue at all about how to do any of them. I can just barely imagine it should be done on _alter or _presave hooks, but I'm not sure, and can't find about.

Current state: Totally n00b and clueless about.  

Notes: Assume hooks as:

function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id)
{
    //validations occur here to test whether the current form is a webform node.
}


EDIT - Additional IMPORTANT notes I forgot: Depending on the value of some fields, I have two possible scenarios:


Avoid saving, then redirect (to external URLs, i.e., urls not belonging to my Drupal install. The redirection url must be the result of an evaluated expression, and not just a single url which I could specify in the webform settings).  
Save, then redirect (to internal URLs, i.e., urls belonging to my Drupal install. The redirection url must be the result of an evaluated expression, and not just a single url which I could specify in the webform settings).
yes hook_form_alter is the right hook you are looking for.

Something like below. Please check the values of form field inside $form_state and fix the code accordingly.

Basically hook_form_alter will allow you wo conditionally add submit handler to your webform which means if form field value is Y then only your custom submit handler will call, also the way we adding the custom submit handler is by replacing the other handlers so no conflict with your sudmit handler and any other comes by default.

function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id)
{
   if($form_id == "your_webform_id") {
     if($form_state['your_form_field']['#value'] == 'Y') {
       $form['#submit'] = 'custom_submit_handler_external';
     }
     if($form_state['your_form_field']['#value'] == 'X') {
       $form['#submit'][] = 'custom_submit_handler_internal';
     }
   }
}

function custom_submit_handler_external(&amp;$form, &amp;$form_state) {
  drupal_goto("redirect to a page");
}

function custom_submit_handler_internal(&amp;$form, &amp;$form_state) {
  $redirect_to = $form_state['redirect_field']['#value'];
  $form_state['redirect'] = $redirect_to;
}


The above code is just an idea of how you can approach, please debug it at every step and make it workable for you.