How call a custom function after input got validated in hook_form_alter? I want to call custom functions for doing some profile filed updation on user registration. So i used to implement my custom functions in hook_form_alter. The code is here

&lt;?php
function calculation_form_alter(&amp;$form, &amp;$form_state, $form_id) {
switch ($form_id) {
case 'user_register':
$form['#validate'][1] = 'do_database_updation';
break;
}
return $form;
}

function do_database_updation($form, &amp;$form_state){
/* perform database updation here... */
}


It works fine, but the problem is when the validation fails, the database updation cannot be retrieved back. I want to call the custom function after validate the input values. How it to do ?
You can add your function in  the [#submit] key. For example : 

if ( empty($form['#submit']) ) {
  $form['#submit'] = array();
}
array_push($form['#submit'], 'do_database_updation');


The submit handler is called after the validation.