Disable pre-emptive validation of empty textfield On my form I have some fields and I set form['#required_error'] to generate a message on empty fields.
Works OK on select and option fields, but not on textfields.

It seems there is a (kind of ajax) validation before, which gives a pop-up with "fill in this field". 

How can I disable pre-emptive validation of empty text fields, so that I can generate my onw messages
The 'fill in this field' message is browser specific HTML5 error handling.
Which is triggered before the form is submitted.
Only modern browsers show this, and it may currently not be consistent between browsers. 

About this behaviour is an interesting discussion here: https://www.drupal.org/node/1797438.

If you have your own logic in place to assist the user with problems in the form you can disable HTML5 validation altogether by setting the novalidate attribute on the &lt;form&gt;. More specific is setting the formnovalidate attribute on a submit button.

In a hook_form_alter you can add the following line:

$form['#attributes'] += ['novalidate' =&gt; TRUE];