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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

DOM search mangles international characters in IE8


Go to End


2 Posts   1244 Views

Avatar
MarcusDalgren

Community Member, 288 Posts

6 August 2010 at 12:54am

Took me awhile to solve this but I finally managed to fix this so that it works in all browsers. The problem is the way the URL is constructed in the js before it's sent. My changes turn the url variables into an object and send it through $.get instead of $.ajax and it now works in all browsers that I've tried.

Request building in the search function line 218

request = window.setTimeout(function() {
	var url = $(container_id).attr('href').replace(/\[search\]=(.)*?&/, '[search]='+$input.val()+'&');
	var getObj = {};
	var getUrl = url.split("?");
	var getVars = getUrl.pop().split("&"); 
	var tempGet = [];
	getUrl = getUrl.shift();

	for (i = 0; i < getVars.length; i++) {
		tempGet = getVars.split("=");
		getObj[tempGet[0]] = tempGet[1];
	}
	refresh($container, getUrl, getObj, '#srch_fld'); 
},500)

Refresh function line 383

function refresh($div, link, getVars, focus)
{
	 // Kind of a hack. Pass the list of ids to the next refresh
	 var listValue = ($div.hasClass('RelationDataObjectManager')) ? jQuery('#'+$div.attr('id')+'_CheckedList').val() : false;
	 	 
	 jQuery.get(link, getVars, function(html){
		if(!$div.next().length && !$div.prev().length)
			$div.parent().html(html);
		else
			$div.replaceWith(html);
		
		if(listValue) {
			jQuery('#'+$div.attr('id')+'_CheckedList').attr('value',listValue);
		}
		var $container = jQuery('#'+$div.attr('id')); 
		$container.DataObjectManager(); 
		if (typeof focus == 'string') { 
			$container.find(focus).focus(); 
		} 			
		//jQuery('#'+$div.attr('id')).DataObjectManager();
	 });
}

Avatar
UncleCheese

Forum Moderator, 4102 Posts

6 August 2010 at 1:19am

Great, thanks for that!