default value bug?
goose2000 - February 13, 2008 - 21:02
| Project: | Email Field |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Not sure why I'm getting these errors, if I add a email cck widget, all of a sudden I get these errors:
* user warning: Field 'field_email_email' doesn't have a default value query: INSERT INTO content_type_appoinment (field_aa_fname_value, vid, nid) VALUES ('Liz', 12, 12) in C:\Inetpub\wwwroot\ambassador\includes\database.mysql.inc on line 172.
* user warning: Field 'field_email_email' doesn't have a default value query: INSERT INTO content_type_appoinment (field_aa_lname_value, vid, nid) VALUES ('Thompson', 12, 12) in C:\Inetpub\wwwroot\ambassador\includes\database.mysql.inc on line 172.
* user warning: Field 'field_email_email' doesn't have a default value query: INSERT INTO content_type_appoinment (field_aa_address_value, vid, nid) VALUES ('7655 New Lane', 12, 12) in C:\Inetpub\wwwroot\ambassador\includes\database.mysql.inc on line 172.
* user warning: Field 'field_email_email' doesn't have a default value query: INSERT INTO content_type_appoinment (field_aa_city_value, vid, nid) VALUES ('Cary', 12, 12) in C:\Inetpub\wwwroot\ambassador\includes\database.mysql.inc on line 172.All these other fields fail to save their values of course. If I remove the email widget, saves fine.

#1
I think I have the same bug:
# user warning: Field 'field_ae_email' doesn't have a default value query: INSERT INTO content_type_pis (field_porta_value, vid, nid) VALUES ('1', 16, 16) in c:\archivos de programa\apache group\apache\htdocs\drupal-5.5\includes\database.mysql.inc on line 172.# user warning: Field 'field_ae_email' doesn't have a default value query: INSERT INTO content_type_pis (field_finca_value, vid, nid) VALUES ('independencia263', 16, 16) in c:\archivos de programa\apache group\apache\htdocs\drupal-5.5\includes\database.mysql.inc on line 172.
# user warning: Field 'field_ae_email' doesn't have a default value query: INSERT INTO content_type_pis (field_planta_value, vid, nid) VALUES ('3er', 16, 16) in c:\archivos de programa\apache group\apache\htdocs\drupal-5.5\includes\database.mysql.inc on line 172.
and so on...
This has happened to me when I've added a new node. "field_ae" is an Email field.
Thanks for the efforts! ;)
#2
This has to be easy to fix. I can't believe more people are not running into this, maybe all their email fields are *Required ? I see this part off the error as a clue:
database.mysql.inc on line 172
This would tell us that the issue is not with the drupal code but with how the database table is set. It must not like being empty or NULL ? So maybe we should look there?
Checking....
#3
Ok, this is the trouble, no default value set or allowed, but I'm not sure where to fix it. For the immediate fix, I changed the databse, had a content type table (training) where the email feild was used. So there I changed the email to NOT NULL unchecked, and default value set to null.
But it's the module that needs fixing, I would change:
/*** Implementation of hook_field_settings().
*/
function email_field_settings($op, $field) {
switch ($op) {
case 'database columns':
$columns = array(
'email' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE),
);
return $columns;
}
}
TO:
/*** Implementation of hook_field_settings().
*/
function email_field_settings($op, $field) {
switch ($op) {
case 'database columns':
$columns = array(
'email' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE), 'default' => "''",
);
return $columns;
}
}
Which is sort of borrowed from the way a text.module is done. Does this help on your side?
Can this be a patch? Anyone? A better way?
EDIT - no this doesn't work, sorry. Anyone else?
#4
I had this happen to me while creating a contact form in Dreamweaver.
I added the email field and validated it AFTER I create the server behavior.
I deleted the server behavior in Dreamweaver and created a new one. It works fine now!!!