There is a hard-coded 1024 chars length for input field.
Are there some technical reasons for that or is it possible to expand this value?
If I paste the link from maps.google the string gets truncated and the map doesn't appear as expected.
Is it possible to define an admin panel to customize this value without the need to modify the module code?

CommentFileSizeAuthor
#2 max-length.patch2.2 KBjellicle_it

Comments

andreashaugstrup’s picture

It's not possible to set as a variable in the user interface because the length limit is also placed in the database table. But perhaps the limit should be raised to 2056 characters if you run into strings longer than the current limit (I didn't during my testing which is the cause behind the current limit).

jellicle_it’s picture

StatusFileSize
new2.2 KB

I've tried to raise max-length to 4096 and everything works fine with firefox.
Internet explorer has a limitation of 2048 chars in URL so i wrote a patch to check the max-length allowed and to expose an error message in the form.
This is my first patch, I hope to have made it correctly! ;-)

andreashaugstrup’s picture

The format of the patch is good. :o)

It seems to me there's no need for the validation step. Just set the #maxlength to 2048 and then the FAPI will ensure that we never see any submissions longer than that?

jellicle_it’s picture

I made a first try without the validation step, but i noticed that no error message was exposed, simply the field gets truncated to the specified length.
This could be ok for a field whose content is manually entered; due to the special nature of this field (cut&paste from maps.google), I need to inform the user that the string pasted from maps.google is too long, the use of validation hook with a length limit less than one specified in the field definition is the only way i've found to gain this behaviour.
I don't know if there is a better way to do this, but i think it's important to inform the user about what's going wrong.

andreashaugstrup’s picture

Status: Active » Fixed

Good point. I've committed your patch to the D6 branch.

Status: Fixed » Closed (fixed)

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