How to get xForms on CMS 5 RC1 working with IE8

by roberto.vega 15. December 2009 10:51

To get xForms to work with IE8 compatible mode u need to change a function in xformedit.js.
U can find the file at /edit/ui/javascript/. Look then for this function:

function formPopulateForSubmit( oForm )
{
   fieldPropertiesHideAll();
   formContent.value = xFormControl.innerHTML;
   return true;
}

 

Replace it with this function instead:

function formPopulateForSubmit( oForm )
{
    fieldPropertiesHideAll();
    
    var cnt = xFormControl.innerHTML;
    var regExpInput = new RegExp(']+>');
    var inputTemp = regExpInput.exec(cnt);
    
    while (inputTemp != null) {
        var regExpType = new RegExp('type=text|type=radio|type=checkbox|type=submit');
        var typeTemp = regExpType.exec(inputTemp[0]);
        var type = (typeTemp != null && typeTemp.length > 0) ? typeTemp[0] : '';
        var str = inputTemp[0].replace(type, '');
      
        if (type == 'type=text') {
            type = '';
            var regExpGuid = new RegExp(' {[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}}');
            var guidTemp = regExpGuid.exec(str);
            if (guidTemp != null && guidTemp.length > 0)
                str = str.replace(guidTemp[0], '');
        } 
        else if (typeTemp == 'type=submit') {
            var regExpOnCLick = new RegExp('onclick=[^\f\n\r\t\v]+');
            var onCLickTemp = regExpOnCLick.exec(str);
            
            if (onCLickTemp != null && onCLickTemp.length > 0) {
                str = str.replace(onCLickTemp[0], '');
                type = onCLickTemp[0] + type;
            }
        }      
        
        str = str.replace('<INPUT', '<$MGL$ ' + type);
        cnt = cnt.replace(inputTemp[0], str);
        var inputTemp = regExpInput.exec(cnt);
    }
    
    while (cnt.indexOf('<$MGL$') != -1){
        cnt = cnt.replace('<$MGL$', '<INPUT');
    }
    
    formContent.value = cnt;
    return true;
}


 

Don't forget to empty IE8 cache and temporarily Internet files.

Tags: , , , ,

Development

blog comments powered by Disqus

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 2.5 Sweden License.


Welcome to the Dropit blog!

Here we, the people that work at Dropit, will write about stuff that interests us. For example web development, especially with .NET and EPiServer - but we'll also talk about other techniques that interest us, marketing on the web, social phenomenons, pop culture, games and software development in general.