How do I alter a field content before saving the form? I have two fields, Transaction type and Amount. I would like to change the value saved by Amount depending on Transaction type. 

e.g.


Transaction type == deposit , amount is a positive value. 
Transaction type == withdrawal, amount is a negative value. 
Transaction type == tax , amount saved is a preset percentage of the value input.
You can do it inside a hook_form_alter in a custom module.

function module_name_form_alter(&amp;$form, &amp;$form_state, $form_id){
  if($form_id == 'your-form-id'){
    if(your conditions){ // single or multipe if condtions based on your requirement.
     $value = 'value based on your condition';// your value based on condition.
    }
   $form['your-field-name']['language'][0]['value'] = $value;
  }
}


Hope this will help you