Change 128 Char limit of URLs to 256 characters

funana - January 27, 2009 - 15:20
Project:userlink
Version:5.x-1.2
Component:Code
Category:bug report
Priority:minor
Assigned:funana
Status:needs work
Description

To change the char limit of 128 for links to 256 you need to change the following:

Replace

$form['url'] = array('#type' => 'textfield', '#title' => t('URL'), '#required' => TRUE, '#default_value' => $node->url ? $node->url

with

  $form['url'] = array('#type' => 'textfield', '#maxlength' => 256, '#title' => t('URL'), '#required' => TRUE, '#default_value' => $node->url ? $node->url

Make sure that the database field allows 256 chars too.

#1

NancyDru - March 6, 2009 - 02:00
Status:needs review» needs work

URLs can be much longer than 256. IE doesn't even complain until they get to 2032.

#2

marcp - March 9, 2009 - 16:53

Do folks have an opinion on what the length should be?

The direction that all of these modules should be heading is towards providing a CCK node type that [probably] uses the Link field type. I think that module is providing a 255 char field -- can anyone confirm?

My long term vision for userlink is to make it go away and/or be as small as possible to leverage other modules.

#3

NancyDru - March 9, 2009 - 17:14

#4

funana - March 14, 2009 - 02:07

Thx for the link!

Yes, full ack generally. I was surprised to find out that is was limited to 128.
In our case 256 seem to fit, but you may want to use more.
It would be nice to know some statistics about URL length "in the wild".

@marcp: Yeah, the code needs some love. It would be very nice if you would continue this project. My php knowledge is very small, but I will definitely try to support you. I'll send you a msg.

 
 

Drupal is a registered trademark of Dries Buytaert.