Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

UploadFiled select from Files error.


Go to End


947 Views

Avatar
zigonick

Community Member, 6 Posts

17 April 2014 at 5:06am

I have an UploadField in a form with setCanAttachExisting(true).
When clicking on the fromFiles button i get the JavaScript error and it doesn't allow users to select an existing image.

Uncaught ReferenceError: jQuery is not defined UploadField_select.js?m=1396993466:21
(anonymous function).

Even though the built in CMS loads the jQuery file before.
If i append the UploadField_Select.js file in the framework with jQuery before it. I get the error
Uncaught TypeError: undefined is not a function UploadField_select.js?m=1397667809:8

I get both these errors with 3.1.4(Dev) and 3.1.2 (Live/Dev)

the default UploadField_Select file
--

(function($) {
	$.entwine('ss', function($) {
		// Install the directory selection handler
		$('form.uploadfield-form #ParentID .TreeDropdownField').entwine({
			onmatch: function() {
				this._super();

				var self = this;
				this.bind('change', function() {
					// Display the contents of the folder in the listing field.
					var fileList = self.closest('form').find('.ss-gridfield');
					fileList.setState('ParentID', self.getValue());
					fileList.reload();
				});
			},
			onunmatch: function() {
				this._super();
			}
		});
	});
})(jQuery);

--