WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Fields
[resolved] ACF4.0 + IE9 + Compatibility View = Problem (12 posts)

  1. ionainteractive
    Member
    Posted 1 year ago #

    Hi all,

    After upgrading to ACF 4.0 today we received several reports of folks not seeing the custom field meta boxes when editing pages, etc. We narrowed it down to folks using IE9 with Compatibility View turned on. When CV is turned off, the plugin functions properly. And we confirmed that this definitely wasn't an issue with the prior version running on our sandbox site. Unfortunately I could not nail down exactly what was failing, but I did notice that in the Screen Options drawer, there were additional checkboxes up there that didn't apply to the page in question (like custom field meta boxes that were template-specific but not for the current template). Perhaps you could look into it?

    Thanks!

    --Mike

    http://wordpress.org/extend/plugins/advanced-custom-fields/

  2. elliotcondon
    Member
    Plugin Author

    Posted 1 year ago #

    Seems like there is a JS error on the page preventing ACF from running its code to show / hide meta boxes.

    Can you check out the console log and report any JS errors?

  3. ionainteractive
    Member
    Posted 1 year ago #

    Okay, I've figured this one out. There's simply a typo in js/input/image.js on line 118. You're defining a JS object, but the last property has a trailing comma. Most JS implementations are savvy about this, but IE9+CV and IE8 are sticklers for form. Just strike the comma from the end of that line and all should be well

    // Create the media frame. Leave options blank for defaults
    _media.frame = wp.media({
    	title : _image.text.title_add,
    	multiple : multiple,
    	library : {
    		type : 'image'
    	},
    });
  4. ionainteractive
    Member
    Posted 1 year ago #

    Hi, just wanted to check in regarding this issue which is still prevalent after the 4.0.1 update. In case my last post was unlcear, the code snippet I quoted from js/input/image.js is uncorrected. The corrected code should be as follows (removing the comma at the end of line 118). Hope this helps resolve the issue with IE9+CV. Thanks!

    // Create the media frame. Leave options blank for defaults
    _media.frame = wp.media({
    	title : _image.text.title_add,
    	multiple : multiple,
    	library : {
    		type : 'image'
    	}
    });
  5. ionainteractive
    Member
    Posted 1 year ago #

    Hi there. Looks like this problem is back again. Your latest update (4.1.5) has an invalid syntax for the the JS object defined in line 129 of js/input/image.js. You need to remove the comma at the end of line 136. The plugin will be broken in most versions of IE until this is resolved. Thanks!

  6. fried_eggz
    Member
    Posted 1 year ago #

    I can confirm that the plugin is broken as of version 4.1.5. No metaboxes are shown on edit page. Tested on firefox.

    Tried to remove the the comma at the end of line 136 but the problem is still there. Broke some of my sites.

    Need to downgrade to version 4.1.4. again.

  7. ionainteractive
    Member
    Posted 1 year ago #

    Fried_eggz' comment led me to look deeper, and I found there is a similar syntax error in js/input/file.js. The comma needs to be removed from the end of line 140 ("filterable: 'all'). A trailing comma on the last item of an object definition will not validate. (It's not like a PHP array.) If you leave the comma, some browsers may not complain, but IE will fail to show all metaboxes and throw an exception.

  8. ionainteractive
    Member
    Posted 1 year ago #

    Okay, sorry but I've uncovered another JS problem. In js/input/ajax.js, on line 24 in the object definition for acf.screen you try to create a key called "return", but that is a JS reserved word so the script doesn't validate in IE. I suggest you strike that line and add "return" as a property using the array syntax after the object definition (being sure to remove the comma from line 23). So the block from line 13 should look like this:

    acf.screen = {
    		action 			:	'acf/location/match_field_groups_ajax',
    		post_id			:	0,
    		page_template	:	0,
    		page_parent		:	0,
    		page_type		:	0,
    		post_category	:	0,
    		post_format		:	0,
    		taxonomy		:	0,
    		lang			:	0,
    		nonce			:	0
    	};
    	acf.screen['return'] = 'json';
  9. fried_eggz
    Member
    Posted 1 year ago #

    Thank you for your investigation ionainteractive!

    However, there must other errors. Plugin is still broken (in FF v21.0) after edits on

    js/input/image.js
    remove last comma on line 136.

    js/s/input/file.js
    remove last comma on line 140.

    Still need to downgrade plugin to version 4.1.4.

  10. roadlittledawn
    Member
    Posted 1 year ago #

    I checked all the above, tried striking that line with return in it to no avail either. Some of my users use IE8, and it's still generating an error at that line, so no metaboxes will load based on the rule I provided (when a certain category is checked off). The error message reads: Expected identifier, string or number.

  11. ionainteractive
    Member
    Posted 1 year ago #

    roadlittledawn (and others), take note that the plugin author has to the best of my knowledge corrected the IE JS issues. If you install the latest version of the plugin from GitHub (as of 1 Jul 2013) the plugin should work properly. In the alternative, install release version 4.1.6 and overwrite the js/input/ajax.js file with the latest version at GitHub (https://github.com/elliotcondon/acf/blob/master/js/input/ajax.js). All of these fixes should be inherited by the next release.

  12. roadlittledawn
    Member
    Posted 1 year ago #

    Excellent. Thanks much, ionainteractive. It's fixed for me.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic