Search code examples
javascriptasp.nethtmlsharepoint-2007

MOSS 07 editform.aspx fails to commit and goes to blank html page


Found solution from Microsoft Blog... see below

OK, to start I don't like the word random but I cannot find any correlation in test cases for this problem so I am going to use random to describe parts of this problem.

The setup: I have a list where i have crated a customized UI for the EditForm.aspx and NewForm.aspx. I use the same JS file and JavaScript between the two of them. I have added in a google map to help illustrate the location selection. I have added extra code to the "OK" button for some dynamic validation. I have done a lot of dynamic menu things as well. All users use IE 9 and the site is on a MOSS 2007 server.

The problem: Only on the EditForm.aspx, clicking OK "Randomly" results in an immediate white screen. The form is not saved and when viewing the source code of the white screen i find a blank html page.

What I have tried to find this problem: - I tried to narrow down the user and computer this happens on and found that it happens for everyone on every computer(once again "Randomly"). - I tried disabling the code that is pre-pended to the "OK" button - I tried following the code with the IE9's external script debugged and found no errors

I can provide the code but it is a bit long and I really do not know where to begin. So i can provide it if needed.

Thanks for the help ahead of time.

Edit: This is the code re-wiring my OK button(i reset the value to "Save" earlier)

    var okBtns = $('input[value="Save"]')
    $.each(okBtns, function(index,value){
        okFunction=$(value).attr('onclick');
        $(value).attr('onclick','return false;')
        $(value).bind('click', function(){
            if ($('#'+StatusBox).val()=='Draft') {$('#'+StatusBox).val('New Request')}
            var err = clickOKbutton();
            if(err==0) {okFunction()};
        });
    });

This is the clickOKbutton function witch is th code prepended to the orgianal sharepoint operations:

function clickOKbutton()
{
    //all of the imput validation i could ever wish for!!!!
    var NoteVal = ''
    var NameAry = $('#'+PersonnelBox).parent().children(":first").children("SPAN").children("SPAN");
    $.each(NameAry, function(index,value){
        var $n=$(value).html();     
        if(NoteVal.length==0) {NoteVal=$n} else {NoteVal=NoteVal+';'+$n};
    });
    //$('#'+AddNotes).val(NoteVal);

    var plh = $('#'+PersonnelBox).parent().html()
    userNameTx = $('#zz8_Menu').text();
    userNameTx = userNameTx.replace('Welcome ','');
    $.each(OICUsers, function(i,v){
        if(plh.indexOf(v) > -1 && st=='New Request'){
            $('#'+StatusBox).val('OIC Bypassed')
            $('#'+CommentsBox).val('OIC is travling on this TDY/TAD and cannot approve. So this request is bypassing the "OIC Approval" step')
        }
    });

    /*userNameTx = $('#zz8_Menu').text();
    userNameTx = userNameTx.replace('Welcome ','')

    $('#' + ModBox).closest('TR').show();*/
    var message=''
    message = detectFieldChanges(AllFieldsArray,AllOrgValArray,"Draft,New Request,Modified")        
    if(message.length>0){
        $('#'+ModBox).val(message);
        AutoResizeTextarea(ModBox);
    }

    message = detectFieldChanges(ValFieldsArray,OrgValuesArray,"Draft,New Request,Modified,OIC Approved,OIC Bypassed,Pending RFI,Ready for COS")
    userNameTx = $('#zz8_Menu').text();
    userNameTx = userNameTx.replace('Welcome ','');
    if(message.length>0&&$.inArray(userNameTx,COSUsers)==-1){
        $('#'+StatusBox).val('Modified').change;
        $('#'+StatusLongBox).val('Modified').change;
    }       


    //Subject box
    var pb = NoteVal;
    var ep = $('#'+ExtPersonnel).val();
    var ab = $('#'+AddressBox).val();
    var sd = $('#'+sDateBox).val();
    var ed = $('#'+eDateBox).val();
    var st = $('#'+StatusBox).val();
    var p = pb+';'+ep;
    var p = p.replace(/mossaspnetmembershipprovider:/g,'');
    var p = p.slice(0,-1);
    var ad = ab+' '+sd+' to '+ed;
    var s = 'eTDY | '+st+' - '+p+' - '+ad;
    if(s.length>255){
        var l = s.length-255;
        p = p.substring(0,p.length-l);
        s = 'eTDY | '+p+' - '+ad;
    }
    $('#'+Subject).val(s);

    //check Lat/Lng value
    if($('#'+LatBox).val()=='' || $('#'+LngBox).val()==''){
        //alert("Cannot continue unless the Lat Lng has a vallid coordinate");
        if($('#LatLngError').length==0){
            errorHTML='<br><span class="ms-error" id="LatLngError">You must specify a value for Lat and Lng</span>'
            $('#'+AddressBox).closest('TD').append(errorHTML)

        }
        return -1
    }
    return 0
};

It is messy but hopefully you can make sense of it.

Edit 2:

I think I have tracked the randomness down... I completely turned off all custom code and still have the problem. I then tried comparing a working record with a non working record. Everything looked normal until i got to the field with a multiple people picker. If i have more than 2 people in that field it will save normal but when i go to make a modification on that record with more than 2 people in the people picker field is causes this problem. I am going to do some more research and will post my results.

Edit 3:

http://blogs.msdn.com/b/jorman/archive/2009/12/22/mystery-of-the-sharepoint-white-screens.aspx

This problem all boils down to IIS configuration and the Impersonation Level. Apparently our server admins decided to change it without telling anyone.


Solution

  • This problem all boils down to IIS configuration and the Impersonation Level. Apparently our server admins decided to change it without telling anyone.

    http://blogs.msdn.com/b/jorman/archive/2009/12/22/mystery-of-the-sharepoint-white-screens.aspx