This is a very specific implementation in order to cause this error, but I believe it signals a larger problem at heart.
Implementation:
- Create a new site with CCK, Views, Date and the new Editview
- Create a content type with a 'Date_popup' field with multiple values.
- Create a view to edit this content type with editview.
- Create a new node of this content type with some dates in the fields and visit the view to edit it.
The bug:
- If you click save on a node which contains multiple dates entered, the form that is returned has blank entries for this field. All other multi-entry fields work as expected.
Going deeper:
What appears to be happening is that editview uses drupal_rebuild_form to build the form up on an AJAX submit. It however does this multiple times as we need the same ID for the form as we had before in order for javascript and the like to behave correctly. On the first pass of drupal_rebuild_form the form_state is correct and as such the form builds correctly and the fields are not blank. However on this pass, by the end of the function something has messed with the form_state array and made it inconsistent. On the second pass, it uses this inconsistent form_state to rebuild the form thus making the form incorrect and the date fields being empty.
More specifically:
Before first pass of drupal_rebuild_form the form_state looks like this:
- values
- date_field
- 0
- value = 2009-01-01...
After the first pass the form_state looks like this:
- values
- date_field
- 0
- value = 0009-01-01...
I don't know what is causing the problem but it's most likely in the widget module for date and I don't know it well enough to debug it further. Also, if you change the widget to date select lists, the returned form get the day and month correct for all the lines, but not the year.
Hope this makes enough sense that you have somewhere to start and hopefully look into the problem, but the main thing is that the widget seems to alter the form_state making it incorrect. Thus any following calls to drupal form functions will have issues.
Thanks,
Nathan
Comments
Comment #1
petey318 commentedSubscribing - this may explain the strange behaviour that I have been seeing with a drop-down year selector in an exposed filter: it is starting at 9, and there are 2000 entries in the drop-down!!
(FYi that issue is here: #367970: Exposed filter with Date field doesn't work)
Comment #2
karens commentedThe date module does some very complex processing during form validation and any module that alters the form state is likely to break it. If editview does that, there's not much I can do, the modules are incompatible. The issue about the view filter is something different, that's a filter that the Date module created, not some other module trying to alter the form.