How to disable max length validation on an entity form?
You didn't give an explanation of your rules for your input, but for an example, imagine that the format of the required value is XXX-XXXXXXXXXX, where X is a numeral, and the hyphen is always at position 4.


Change the maxlength on the HTML input to allow more characters. Add your own validation handler to be run before the default validation handlers. Add your own submit handler to be run on submission.

use Drupal\Core\Form\FormStateInterface;

function HOOK_form_alter(array $form, FormStateInterface $form_state, $form_id) {
  if ($form_id == 'some_form_id') {
    if (isset($form['some_field'])) {
      // Change the HTML max length to 14.
      $form['some_field']['#maxlength'] = 14;

      // Insert a custom validation handler to be run BEFORE
      // the default handlers.
      array_unshift($form['#validate'], 'my_module_FORM_ID_validate');

      // Add your own submit handler to deal with the submitted values:
      $form['actions']['submit']['#submit'][] = 'my_module_FORM_ID_submit';
    }
  }
}

In the validation handler, parse the value in this handler, replacing the value in the field with the 10-character value, so it can pass validation. Store the other 4 characters in the $form_state

function my_module_FORM_ID_validate(array &amp;$form, FormStateInterface $form_state) {
  if ($value = $form_state-&gt;getValue('some_field')) {
    // Check that the submitted value is in the right format, and
    // parse the value into $matches.
    if (preg_match('/(\d{3})-(\d{10})/', $value, $matches)) {
      // Store the 10-digit value in the field, to be passed through
      // default submit handlers.
      $form_state-&gt;setValueForElement('some_field', $matches[2));

      // Store the other three digits in the $form_state.
      $form_state-&gt;set('some_key', $matches[1]);
    }
    else {
      // The submitted value was not in the correct format.
      $form_state-&gt;setError($form['some_field'], t('Some Field must be in the format XXX-XXXXXXXXXX where the Xs are numeric'));
    }
  }


}
Use the values as necessary in the submit handler.

function my_module_FORM_ID_validate(array &amp;$form, FormStateInterface $form_state) {
  $key1 = $form_state-&gt;get('some_key');
  $key2 = $form_state-&gt;getValue('some_field');
  // Do what you need with these values.
}