It seems that a long machine name causes some major issues with views not being saved.
Example 1:
I have a view with a machine name of 'calendar_events_by_production' (37 chars). If I clone this view and name the clone 'calendar events by regular production' then the new machine name of 'calendar_events_by_regular_production' is generated. On immediately attempting to save the view, the following error is shown and the saving fails.
PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'name' at row 1: INSERT INTO {views_view} (name, description, tag, base_table, human_name, core) 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); Array ( [:db_insert_placeholder_0] => calendar_events_by_regular_production [:db_insert_placeholder_1] => List of calendar events for a production [:db_insert_placeholder_2] => default [:db_insert_placeholder_3] => node [:db_insert_placeholder_4] => Calendar events by regular production [:db_insert_placeholder_5] => 7 ) in views_db_object->save_row() (line 1945 of /Applications/MAMP/htdocs/hhp2011/sites/all/modules/views/includes/view.inc).
Doing the same steps again but creating a machine name of 'calendar_events_by_produ' (32 chars) saves successfully as expected.
Example 2:
A related issue happens when creating a new view from scratch. I go to /admin/structure/views/add, and name the new view 'Calendar Events by Regular Production'. The matching machine name is shown by the side but none of the buttons at the bottom of the overlay result in an action until the machine name is changed to be 32 chars or less. There is no visual warning that the length is exceeded, so the user has no idea why the buttons don't work.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 1180560-clone-view-validation.patch | 742 bytes | dawehner |
Comments
Comment #1
dawehnerHere is a patch for the first part of the issue.
The second one will be pretty tought because that's basically a core bug from my perspective.
Comment #2
merlinofchaos commentedI think #2 is because Seven, for some reason, does not properly style disabled buttons. That is definitely a core bug.
Comment #3
dawehnerCommited to 7.x-3.x
@martinjbaker do you want to create an core issue and link it here? This would be cool
Comment #4
Anonymous (not verified) commentedEven if they were disabled (and visually so), how would the user know that there was a restriction on the length of machine names? If I go to "Add new view" and immediately press the "Save & exit" or "Continue & edit" buttons then I get these warnings:
It isn't possible to get to that stage if the machine name is too long.