attribute cannot be longer than 128 characters but is currently 488 characters long

Created on 2 May 2019, about 5 years ago
Updated 1 December 2023, 7 months ago

I'm using views_autocomplete with a core FieldUI field no problem, as follows in a hook_form_alter:

  $form['field_myfieldname']['widget'][0]['value']['#autocomplete_route_name'] = 'views_autocomplete_api';
  $form['field_myfieldname']['widget'][0]['value']['#autocomplete_route_parameters'] = array('view_name' => 'myviewname');

However, the field UI max_length is set to 500 yet I receive the following error any time a value over 128 chars is saved:

attribute cannot be longer than 128 characters but is currently 488 characters long.

The form saves, and the data is recorded correctly (the full chars), but error displays.

It only displays when:

  1. the form_alter code above is on the field (works fine without the autocomplete)
  2. the value is changed -- probably because it's triggering the autocomplete. Just resaving the form without triggering the autocomplete doesn't pop the error.

It's easily reproducible by adding views_autocomplete_api autocompletion to any core field ui textfield where the maximum length setting exceeds 128 and you enter a string greater than 128 chars.

I've been over every single line of code in every file and tried manually settin the #max_length attribute in all different parts of the form field array and I'm stumped as to where the 128 is overriding my field setting of 500.

Just looking for some inspiration on what else to try.

Thanks.

πŸ› Bug report
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States WorldFallz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024