Drupal 7: Add markup to form during validation I have a custom validator on a webform. When a person enters an address, I validate it. When the address is not right, I set an error in the validation function. This is all going well. But now I want to give the visitor suggestions when he enter a wrong address. This should be done by giving the suggestion in a markup underneath the address input.

I allready set up an empty markup field in the webform, now I just want to put information in it during validation. How is this possible. If you need any dpm or printout let me know please.

Thanks in advance.
In your validate you can set a variable in the $form_state that tells if the validation failed or not:

function webform_validate_handler(&amp;$form, &amp;$form_state) {
  if ($mail_invalid) {
    $form_state['mail_invalid'] = TRUE;
  }
  else {
    $form_state['mail_invalid'] = FALSE;
  }
}


Then in your form, you can check for empty($form_state['mail_invalid']) and show the markup when the empty check returns false.

function hook_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  ...
  if (!empty($form_state['mail_invalid']) {
    $form['markup'] = ...;
  }
}