Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » DOM search mangles international characters in IE8

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 816 Views
  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    DOM search mangles international characters in IE8 Link to this post

    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();
        });
    }

  • UncleCheese
    Avatar
    4085 Posts

    Re: DOM search mangles international characters in IE8 Link to this post

    Great, thanks for that!

    816 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.