Basic validation needed for date values!

gabble - September 7, 2008 - 14:07
Project:Birthdays
Version:5.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:maartenvg
Status:closed
Description

In my experience, users often forgot to set their year of birth in their profile; The date field provided by the profile module defaults to "this year" (now is 2008), so the users' age is often 0 or even -1.
I am aware this is a problem with the profile module, whose date field defaults to today's date, instead of displaying '--' for empty values (see http://drupal.org/node/74120).

I kindly ask if there is a way to workaround this, and in any case I guess the bithday module should do a basic validation before accepting date values (a site user can't be born this year!).

What do you think?
Any help would be appreciated.

#1

gabble - September 7, 2008 - 14:30
Category:feature request» support request
Priority:normal» critical

There are a couple of more annoying issues:

1) How can I make the birthday date a required user input? It doesn't matter if I check "The user must enter a value" in the date field settings, the date always has a default value, so the user is not forced to set a date

2) When the date field is visible in the registration form, and the user doen't set his birth date leaving the field untouched, the birthdays module assumes the user is born today. This can't be acceptable!

Mmh… am I missing something??

#2

maartenvg - September 16, 2008 - 10:39
Category:support request» feature request
Priority:critical» normal
Assigned to:Anonymous» maartenvg

Both issues are the fault of the date element provided by core, which won't be changed for D5.

I will create a work around for it.

#3

gabble - September 16, 2008 - 13:46

Looking forward to it! :-)

#4

maartenvg - September 30, 2008 - 22:47

This has been fixed in D6! I found a way to alter the date field to include '--' options and default to those.

That way
- the field can be empty by default
- required field can be checked
- there is no more need for deletion permissions (just set it to required)
- there is no more need for ugly checkboxes to remove the date of birth.
- no more accidental birthdays or ages 0 or -1.

Will port to D5 as soon as possible.

#5

maartenvg - October 1, 2008 - 11:37
Status:active» fixed

And ported it back to D5 in 5.x-1.x-dev. I will issue a new release which will include these changes later.

#6

gabble - October 3, 2008 - 16:17

Works beautifully! Thank you!!!!!!!!!!!!!!!!

#7

maartenvg - October 3, 2008 - 20:34

no problem. Glad to be of service :)

#8

gabble - October 6, 2008 - 11:08

Just one glitch:
When you do not enter any date values as birthday (--, --, ----), the user's profile page displays:

Birthday:
January ()

Can you reproduce the issue?

#9

maartenvg - October 6, 2008 - 12:09
Version:5.x-1.1» 5.x-1.2

That's weird, and wasn't intentionally. In fact, I can't reproduce it.

Did you use 5.x-1.2?

#10

gabble - October 6, 2008 - 13:49

Yes, 5.x-1.2!

This only happens for user's profiles created after module installation. The date field linked to the birthday module is visible in the registration form but not mandatory. When the user fills out the form, leaving the birthdate untouched (--, --, ----), the user's profile page displays: "January ()".
Therefore I guess it may also happen when a user edits his own profile without setting his birthdate.

Can you confirm this?

Thanks for your time.

#11

maartenvg - October 6, 2008 - 14:35
Status:fixed» postponed (maintainer needs more info)

I still can't reproduce this bug.

This is what I do:
- Clean install, no other modules
- Added a date field with category "About me", not required and visible on the registration form and "Visible on the profile, but not listed in the user list".

The following things work without problems here
- Creating a user without entering a birthdate: birthday is not visible
- Creating a user with birthday: birthday is visible
- Editing the user, not altering a previously set birthday: birthday stays visible
- Editing the user, removing a previously set birthday: birthday is removed
- Editing the user, adding a birthday where there wasn't one yet: birthday is visible

I did encounter a problem when creating a user, which I just fixed in CVS. You might try that version (the .tar.gz is not updated yet, though, you will need to get it directly from CVS or wait a few hours. birthdays.module v 1.2.2.49).

I would appreciate it if you give the following information:
- What (contributed) modules do you have enabled
- Have you tried it on a clean install?
- What theme do you use?
- Do you have more profile categories & profile fields? If so, what?
- What versions of PHP and MySQL/PGSQL do you use?
- anything else I might want to know.
- which of the above 5 situations do not work?

#12

maartenvg - October 6, 2008 - 14:36
Category:feature request» bug report

This has become an bug report.

#13

gabble - October 6, 2008 - 15:31

- What (contributed) modules do you have enabled

Drupal 5.10

Admin block 5.x-1.0
Auto Time Zone 5.x-1.0
Backup and Migrate 5.x-1.1
Birthdays 5.x-1.2
CAPTCHA 5.x-3.1
Counter 5.x-1.9
DB Maintenance 5.x-1.2
DHTML Menu 5.x-1.5
download_count 5.x-1.0
External Links 5.x-1.6
FCKeditor - WYSIWYG HTML editor 5.x-2.1
FeedBurner 5.x-1.x-dev (2007-Ott-17)
Find URL Alias 5.x-1.4
Flag content 5.x-2.8
Global Redirect 5.x-1.3-1
Google Analytics 5.x-1.6
HTML to text 5.x-1.1
IMCE 5.x-1.2
Internationalization 5.x-2.4
Javascript Tools 5.x-1.1
LoginToboggan 5.x-1.3
Mail editor 5.x-1.1
Meta tags 5.x-1.12
Node Teaser 5.x-1.1
Page Title 5.x-1.1
Panels 5.x-1.2
Password Strength 5.x-1.2
Path Redirect 5.x-1.2
Pathauto 5.x-2.3
Pressflow Preempt 5.x-1.0-1
Private Upload 5.x-1.0-rc2
Re: Comment subjects 5.x-1.3
Safari Search 5.x-1.3
Scheduler 5.x-1.16
Search 404 5.x-1.3
Service links 5.x-1.1
Similar Entries 5.x-2.0
Site map 5.x-1.2
Subscriptions 5.x-2.3
Taxonomy Access Control 5.x-1.1
Token 5.x-1.11
Update Status 5.x-2.3
Upgrade Status 5.x-1.3
Username originality AJAX check 5.x-1.x-dev (2007-Lug-24)
Views 5.x-1.6
Views Bonus Pack 5.x-1.1
XML Sitemap 5.x-1.6

- Have you tried it on a clean install?

No, this is a working web site, I cannot test on a dummy server, unfortunately…

- What theme do you use?

I made the theme myself

- Do you have more profile categories & profile fields? If so, what?

profile_name -> textfield -> General
profile_last-name -> textfield -> General
profile_town -> textfield -> General
profile_occupation -> textfield -> General
profile_website -> URL -> Miscellaneous
profile_setup -> textarea -> Miscellaneous
profile_google_adsense_client_id -> textfield -> Miscellaneous
profile_birthday -> date -> Miscellaneous (not required and visible on the registration form and "Visible on the profile, but not listed in the user list".)

- What versions of PHP and MySQL/PGSQL do you use?

Apache/2.2.9 (Debian)
PHP/5.2.6-3 with Suhosin-Patch
mod_perl/2.0.4
Perl/v5.10.0
MySQL 5.0.51a

- anything else I might want to know.

Last minute update:

1) I created a dummy user, filled out the form, did not touch the profile_birthday input. The user page has "January ()" (actually is "Gennaio ()", Italian language translated for you).

2) Then I edited the newly born profile, didn't click on the Miscellaneous tab (where profile_birthdate is), just stayed within General where the birthdate fileld is not visible. Clicked on Save (without touching anything). The "Gennaio ()" still displays on the user's page.

3) Then I edited the newly born profile again, clicked on the Miscellaneous tab (where profile_birthdate is visible), clicked on Save (without touching the date values). The "Gennaio ()" now disappears from the user's page.

- which of the above 5 situations do not work?

The module is fully functional, no problem with anything else, it's just a display glitch!

#14

maartenvg - October 6, 2008 - 20:06

Thanks for all the information. The only thing I can come up with, is that one of your other modules is interfering, or that the birthdays-module hasn't got the right weight.

There are 2 things you might want to check in the database:
- In the table system you have a column weight, check whether the Birthdays module has a lower weight than the Profile module.
- If you create a new user, (which will show "Gennaio ()") check the dob table and the users table (data column) and the profile_values table (for the date field) and report back here what it says, for that UID.
- Switch temporarily back to Garland and check if that helps
- Experiment with temporarily disabling some modules. Like the ones that work on users or profiles as Logintoboggan, Username originality AJAX check, Path redirect, Global redirect, and other.

I'll try to look for a solution as well.

#15

maartenvg - October 6, 2008 - 20:52

Ok. I've reproduced the behavior (on a backup of a production site featuring a lot of the modules you use). I can now find a solution for it.

#16

maartenvg - October 6, 2008 - 21:15

The culprit was LoginToboggan, but I've found a way to work around it.
I'll commit it as soon as possible.

#17

maartenvg - October 6, 2008 - 21:36
Version:5.x-1.2» 5.x-1.x-dev

Ok it's in CVS (DRUPAL-5). Have fun testing! This should work with or without LoginToboggan.

#18

gabble - October 7, 2008 - 08:44

Thanks for your wonderful support!
Looking forward to it!

Have a nice day!

#19

maartenvg - October 8, 2008 - 10:00
Status:postponed (maintainer needs more info)» fixed

#20

Anonymous (not verified) - October 22, 2008 - 10:01
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.