The subqueue form does not specify a maximum length for the textfield, so it uses the default Form API #maxlength value of 128. Node titles can be up to 255 characters long. When trying to add a node to a subqueue with a long title, form validation fails.

Attached is a patch to fix.

Comments

bdurbin’s picture

Status: Active » Reviewed & tested by the community

Ran into the same issue. The above patch worked for us.

schnippy’s picture

Had the same problem and the above patch is working for us. The autocomplete form field is only saving the nid in the nodequeue tables (so no database schema issues) but the validation error is coming from javascript because its counting the text of the title in the autocomplete field and not just the node number value, ex:

"A ridiculously long title that is breaking my design and really ought to be edited down to something a little more manageable and readable [nid:201]"

This patch works but might break again if I have a node title that is exactly 255 characters as autocomplete will add the [nid:201] to the string, which will trigger the javascript validation.

mcarbone’s picture

Status: Reviewed & tested by the community » Needs work

I think it should be increased arbitrarily to something like 500 to handle the problem mentioned by schnippy in comment #2 (and other problems such as character encodings). It's not as if that title gets added to the database at any point anyway -- it's merely used as a guide for the user as only the nid is really important.

gnindl’s picture

Status: Needs work » Needs review
StatusFileSize
new897 bytes

You can also calculate the maxlength automatically based on the highest node. This is slightly less performant but a more elegant solution

mcarbone’s picture

That doesn't address character encoding issues caused by check_plain. For instance, pull up a node title with an ampersand or left/right arrow and suddenly you have something legitimate over 255 characters in that box. I admit, however, that this is an edge case.

jrabeemer’s picture

+1
This is a big bug that I see on my site as well.

jaydub’s picture

I think it would be fine to simply make the maxlength something like 255 + X w/o worrying about finding the actual max length in the node table per #4. Would 300 be more than enough to allow for the [nid: YYYYYYYYY] and any encoding? Seems like a simple fix here...

jrabeemer’s picture

Priority: Normal » Major

Increasing priority. This bug is a show stopper on one of my projects. If you use auto-node-title module against long content, which in turn creates long node titles, this bug becomes apparent.

jrabeemer’s picture

300 characters would leave an integer number YYY at 37 places. Up to sextillion nodes in ASCII? :) What would be the worst case unicode title?

amateescu’s picture

Version: 6.x-2.9 » 7.x-2.x-dev
StatusFileSize
new511 bytes
new510 bytes

Core's taxonomy.module uses a maxlength of 1024 in taxonomy_field_widget_form() and I think this is a good example to follow.

If someone really needs to exceed that limit, they can always use hook_form_alter() to adjust this value.

Edit: Although taxonomy.module uses this limit for terms, this solution was also adopted by the Drupal Commerce module in #1115994: Increase product reference autocomplete textfield maxlength from 128 to unlimited.

amateescu’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.