Steps:
1. Go to admin/structure/types/manage/page/fields.
2. Try to add a new field, enter label and field name, but leave field and widget type as is.
3. Validation fails as expected, but the dynamic widget select list is broken. See: http://img.skitch.com/20100630-pfa2s8rypnbjfces3d47kjxtjm.png

Also, a JS error is shown in console: http://img.skitch.com/20100630-rjeyyx2f3i31pu3inj4jj1kbuf.png

Uncaught TypeError: Cannot call method 'match' of undefined

I've tested it in Chrome 5 and Firefox 3.5, occurred in both. Seems like it doesn't matter how the validation fails.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zserno’s picture

Title: Field UI JavaScript is broken after validation fails due to en error in toolbar.js » Field UI JavaScript is broken after validation fails due to an error in toolbar.js

Relevant code has been added in #535066: Use CSS3 / IE filter to render toolbar shadow.
Can somebody test it in IE? This is an IE specific bugfix, so if it works in IE, there could be a check in the code for browser type, so it wouldn't break in other browsers either. E.g.

if ($('#toolbar').css('filter')) {
zserno’s picture

asrob’s picture

I have tested it in Chrome 5 and Firefox 3.6.6 on Arch Linux and I have not got this error.

casey’s picture

Component: toolbar.module » overlay.module

This is actually an overlay issue; it removes the page_top region (which includes the toolbar), but the attached javascript in there is still being added to the page.

David_Rothstein’s picture

Status: Active » Needs review
FileSize
1.14 KB

This patch is kind of ugly, but I believe it's the correct solution.

zserno’s picture

Patch works great, I tested it in chrome 5, FF 3.6 and IE 7.
One edgecase: there is a drupal_render_page call before restoring the original css+js files. In theory, a module could use hook_page_build (which is called by drupal_render_page) to add it's own css or js, but those won't be included.
Is it something we should care?

casey’s picture

Status: Needs review » Reviewed & tested by the community

overlay_render_region() is used to check for changes in content. Added css/js (through hook_page_build or any other way) aren't added tot the content of the region (but to <head>) so it doesn't really matter.

I don't think we can fix this in a cleaner way. Anyways, it does the job.

casey’s picture

Toolbar bug mentioned in #1 does still exists too: #854956: Error: $("#toolbar").css("filter") is undefined.

David_Rothstein’s picture

Yes, I meant to respond here sooner, but that explanation sounds about right.

We already hint at that in the PHPDoc of overlay_render_region() but could perhaps explain it a bit more, so I added some additional PHPDoc to that effect in the attached patch. Shouldn't change the RTBC status unless someone disagrees with the new PHPDoc :)

ksenzee’s picture

Nope, agree it's still RTBC.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.