In a standard page load, each form that is built calls drupal_html_id() to get an unique form id across the entire page load. However, in the case of the IPE, there is a fair bit of form rebuilding that does not require a page load. As a result, a situation arises where a single form on the page (for example, #search-form) begins to change its ID each time the IPE is invoked (becoming #search-form--2 and then #search-form--3 and so on). This breaks various CSS assumptions (i.e. Bartik's theming of #search-form) and plenty of JS targeting.
This patch resets the $_POST['ajax_html_ids'] array upon saving the IPE which solves the problem of duplicate IDs since when drupal_html_id() inspects it upon rebuilding it can correctly generate the right and assumed ID. I am not sure if this is the right way to invalidate this, but wanted to open an issue with a patch to consider resolutions.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | panels-ipe-reset-html-ids-take4.patch | 856 bytes | populist |
| #2 | panels-ipe-reset-html-ids-take3.patch | 1.33 KB | populist |
| #1 | panels-ipe-reset-html-ids-take2.patch | 879 bytes | populist |
| panels-ipe-reset-html-ids.patch | 771 bytes | populist |
Comments
Comment #1
populist commentedHere is a slight update that moves the html clearing a little higher up in the load order to make sure the ids get reset properly.
Comment #2
populist commentedAnd one more that also includes the case of changing layouts (as well as customizing the page) in the IPE.
Comment #3
populist commentedHere is an update to keep with the -dev magic. .
UPDATE - PLEASE IGNORE PATCH 4. That was done against the Drupal 6 branch and, as we know, D6 is the past!
Comment #4
merlinofchaos commentedCommitted and pushed.