I have a form, with multiple (ajax) components. I have added a simple button in the middle of this form, to validate custom fields.
$form['fieldset_2']['forward'] = array(
'#type' => 'button',
'#value' => t('Forward'),
'#name' => 'btn_forward',
);
As expected, button call validation function in which I check if all values are correct.
The validation messages are not rendered immediately. I have to refresh page to get the error messages. The button doesn't use ajax.
I have a field type radios and form_set_error doesn't color the element with red or something.
drupal_get_form
? Sounds like it's happening too late (after Drupal has already finished setting messages for the current request).