Incomplete date fields seem to get through validation, when they would be caught otherwise.
Steps to reproduce:
- Install the needed modules
- Create a fieldgroup for orders
- Add to it a date field that collects Year, Month, Day, Hour, Minute, with timezone set to "Date's time zone"
- Configure the date field as "Pop-up calendar"
- Make the pane appear on a checkout page
- Start the checkout process
- Enter the date from the calendar, but omit the time
- Submit the form
The expected result is that validation would catch the missing date components.
What actually happens is that the module tries to do a DB INSERT and fails like this:
PDOException: SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 1: INSERT INTO {field_data_field_network_test_time} (entity_type, entity_id, revision_id, bundle, delta, language, field_network_test_time_value, field_network_test_time_timezone, field_network_test_time_offset) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6_date, :db_insert_placeholder_6_time, :db_insert_placeholder_7, :db_insert_placeholder_8); Array ( [:db_insert_placeholder_0] => commerce_order [:db_insert_placeholder_1] => 28 [:db_insert_placeholder_2] => 146 [:db_insert_placeholder_3] => commerce_order [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_7] => America/New_York [:db_insert_placeholder_8] => [:db_insert_placeholder_6_date] => Aug 28 2012 [:db_insert_placeholder_6_time] => ) in field_sql_storage_field_storage_write() (line 448 of /path/to/commerce_kickstart-7.x-1.8/modules/field/modules/field_sql_storage/field_sql_storage.module).
As this seems to be a validation issue, it might be related to #1467168: #element_validate fails
Comments
Comment #1
brucebertrand commentedUpdate: It seems like the INSERT is firing before validation runs. (Is this normal?)
If you do all of the above steps, but leave out some other required field on the order, you still get the error.
Fill in the date and time properly, but leave off the other required field, and the form validation runs as expected, prompting you to enter the missing data.
Comment #2
pcambraSee #1370892: Does not "require" required fields in fieldgroup panes