The date type of forms is not working. Looking at the generated HTML, all fields of get the same name attribute in the select tags for days, months and years.
For example:
<select name="edit[profile_birth]" id="edit-profile_birth"><option value="1">Jan</option> [...]
<select name="edit[profile_birth]" id="edit-profile_birth"><option value="1">1</option> [...]
<select name="edit[profile_birth]" id="edit-profile_birth"><option value="1900"> [...]
Looking at the source code, function expand_date does not define #name fields. So function _form_builder assigns a name in the recurse for month, year and day. This is done using:
$form['#name'] = 'edit[' . implode('][', $form['#parents']) . ']';.
This bases the name only upon the parent, and nowhere uses an child-specific name. Hence this problem.
I am not sure whether the fix would be to change expand_date to add #name fields (nasty), to change expand_date to generate more sensible #name fields, or whether the root cause is somewhere else again.
One way to reproduce this bug is to enable the profile module, define a date field (for example birthday) and try to fill it in. You will see a wrong date is entered.
Frodo
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | form_date_1.patch | 741 bytes | chx |
| #2 | form_date_0.patch | 1.62 KB | chx |
Comments
Comment #1
fax8 commentedI confirm this bug...
Comment #2
chx commentedAnd I fixed this bug. Very easy.
Just by looking into this, I discovered two profile bugs, will file tickets.
Comment #3
chx commentedA few notices are removed in that patch which are not relevant to this issue.
Comment #4
dries commentedCommitted to HEAD. Thanks.
Comment #5
(not verified) commented