Use ISSET - Not all forms have a field called "Title"

NancyDru - November 14, 2007 - 01:51
Project:Longer Node Titles
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:NancyDru
Status:closed
Description

Not all forms have a field called "Title". You should do something like this:

  if (isset($form['title'])) {
    $form['title']['#maxlength'] = 255;
  }

#1

yngens - November 14, 2007 - 02:41

thanx. will update together with http://drupal.org/node/191815

#2

StephanieM - November 21, 2007 - 21:03

Hi:

I tried this out but the installer fails when trying to update the table for the new column width. Not sure what DB your "ALTER TABLE" command is for but it fails with MySQL. A test for DB type would be a good idea, then for the MySQL case use something like

ALTER TABLE node MODIFY COLUMN title VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

I ended up manually updating the table and all was well.

#3

yngens - November 24, 2007 - 15:50

sorry, have no time to properly configure and update this. could anyone post a valid patch, please.

#4

NancyDru - December 12, 2007 - 00:32

The correct install code should be:

function longer_titles_install() {      
  $result = db_query("ALTER TABLE {node} CHANGE 'title' VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;");
  $result = db_query("ALTER TABLE {node_revisions} CHANGE 'title' VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;");

The column name needed to be in quotes. And table names are supposed to be in curly brackets.

Note: you need to change the "node_revisions" table as well.

#5

yngens - December 14, 2007 - 01:45

Dear Nancy,

I am so busy currently and because unexperienced also having troubles with properly using my CVS account. So if you could please update this module - I already have granted CVS account to you. Don't bother if you can't. Thanks!

#6

NancyDru - December 14, 2007 - 03:52

Okay. I'll try not to mess it up myself.

#7

NancyDru - December 14, 2007 - 13:48
Title:Use ISSET » Use ISSET - Not all forms have a field called "Title"

#8

NancyDru - December 14, 2007 - 13:50
Assigned to:Anonymous» NancyDru
Status:active» fixed

Fix committed

#9

Anonymous - December 28, 2007 - 13:53
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.