Download & Extend

Blank fields retained when you choose multiple

Project:Phone
Version:6.x-2.7
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

This patch fixes the fact that empty rows are stored in the database when multi-field is chosen. If only one phone number is given, it is stored with an additional 2 blank fields. This is even more important if you include the patch to allow the user to select number of fields in the multi-field ( http://drupal.org/node/275837 ) - they could have up to nine blank fields then.

AttachmentSize
phone.module.blank_.data_.diff714 bytes

Comments

#1

Title:Blank data is being stored in the database when you choose multiple.» Blank fields retained when you choose multiple
Version:5.x-2.11» 6.x-2.7
Priority:normal» critical
Status:needs review» active

This is still happening in 6.x. Changing to active since new patch is needed.

"Critical" because this is causing major data nastiness and wreaks havoc on views containing nodes with Phone (CCK) fields.

#2

I solved the problem by changing the hook_content_is_empty

from:
function phone_content_is_empty($item, $field) {
return FALSE;
}

to:
function phone_content_is_empty($item, $field) {
if (empty($item['value'])) {
return TRUE;
}
return FALSE;
}

#3

Status:active» reviewed & tested by the community

esezako's suggestion is the correct solution at least as far as CCK on D6 goes. Attached is a patch with the changes.

AttachmentSize
phone_275843.patch 565 bytes

#4

Status:reviewed & tested by the community» fixed

Taken into account in 6.2.9 version

#5

Status:fixed» closed (fixed)

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

nobody click here