SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    New Castle, PA
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Odd issue with IE 6/7 and Prototype evalScripts:true

    I've run into an odd issue that is very difficult for me to recreate, but I can detail the symptoms. In a nutshell, certain IE 6 / 7 users are unable to use one of our applications because evalScripts does not appear to be evaluating the javascript in any AJAX responses, but others are experiencing no issues.

    One example is a dropdown that populates another dropdown below it. I won't include the exact code, but is something like this:

    Code:
    <select name="userGroup" id="userGroup" onChange="ajaxPostCall('divisionDropDown','../ajaxBackEnds/dropDowns/?p=adduser',null,'addUser');" style="width:318px;">
    	<option selected value ="Please Select">Please Select</option>
    	<option value="AIG">Analytical Instruments Group</option>
    
    	<option value="SDG">Specialty Diagnostics Group</option>
    	<option value="BD">Biosciences Division</option>
    	<option value="LPG">Laboratory Products Group</option>
    	<option value="CCG">Customer Channels Group</option>
    	<option value="BSD">Test Services Division</option>
    	<option value="CORP">Corporate</option>
    
    </select>
    Once a selection is made above, the following javascript fires:
    Code:
    function ajaxPostCall(layerToUpdate,urlTo,extraArgs,formToSerialize) {
    
    var finalArgs;
            if(extraArgs){
            	finalArgs = Form.serialize($(formToSerialize))+extraArgs+'&tSent='+new Date().getTime();
            } else {
            	finalArgs = Form.serialize($(formToSerialize))+'&tSent='+new Date().getTime();
            }
    
    	
     ajax =  new Ajax.Updater(layerToUpdate,urlTo,
            	
             { method:'post' ,evalScripts:true,  parameters : finalArgs});
             Ajax.Responders.register(globalHandlers);
             
    }

    Which in turn fires this (truncated) PHP:

    Code:
    //ADDED THIS LINE TO HELP A USER TROUBLESHOOT
    echo '<script type="text/javascript">alert("Got it");</script>';
    
    //THIS CODE POPULATES THE 2ND DROP DOWN...				$display->drawSelect($divisions[$_POST['userGroup']], null, 'width:318px;', NULL,'onChange="singleValidation(this.id,\'selecttext\');CheckForOther(this.id);"', 'userDivision', 'userDivision', 'Division:', 0, 1,null, null,null, null,'*&nbsp;');

    The above PHP snippet works and the AJAX portion of the functionality fires for ALL users, but the test javascript alert() does not for these few users.

    I had a user on the phone looking at the same code and while I was changing the drop down, the alert() was firing on my end with no issues. It was processing the AJAX call properly on her end, but no alert().

    Out of 150 or so users that span multiple browsers and versions, this issue is happening to 4 people. It's not specific to Prototype (using version 1.6) because the same issue happens with MooTools. The response returns but throws away the javascript.

    Has anyone experienced anything like this and if so, how did you fix? Is it a security issue / setting with IE 6/7?

    *** just to clarify - I did try adjusting the various security settings in IE to all different levels to see if that was the issue, but it was not ***

    thanks VERY much in advance!
    Jon
    Last edited by jreider; Mar 3, 2009 at 03:18. Reason: clarification

  2. #2
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    New Castle, PA
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I created a test URL to generically emulate the code.

    http://ebiz.thermofisher.com/test/

    If anyone does NOT see the "Gotcha!" alert, you have successfully recreated the issue.
    Thanks in advance!

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    With those who don't see the gotcha alert, is it because the responseText is empty, or because the added script code isn't run processed by the browser.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #4
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    New Castle, PA
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the quick reply!

    the 'run processed by the browser' part is what I need to understand and fix. Do you know of any IE settings that would let AJAX function normally, but not process scripts returned in the responseText?

  5. #5
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    New Castle, PA
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I found a post on another site that offered a work around for running evalScripts. I added it to the test code for the URL offered above. I had one of the problem users load the above URL. They can now see the alert(), but it says [object Error] instead of "Gotcha!". Getting closer, but still have some digging to do :-)

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Let's try and break down where the issue is occurring.

    The php is sending text back to the client, and the client is adding that text to the web page.

    It seems to be the second part that's causing the trouble. It should be possible to rule out ajax as being responsible for the problem, by not performing the ajax part and just sending the raw text straight to the evalScript function.

    If the problem still exists then you've made it a lot easier to solve the problem, because you then know that ajax is completely unrelated to the problem.

    Narrow down the conditions for the problem to occur and you'll soon wind up with the cause, and from there, the solution.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    New Castle, PA
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The evalScript() function I added was just a test to see if it made any difference to our problematic users. I have already ruled out Prototype and its ajax functionality as the problem. What is making this frustrating is that it does not affect all Internet Explorer users, only these four folks in one specific office. I have reverted the code offered above back to its original state (and how it would appear in our application) to see if anyone else on here is able to recreate. Thanks for taking the time to help out!

  8. #8
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Hang on, proximity is the common thread there. The four people are in one specific office.

    This indicates to me that their computers may have certain security settings to prevent certain types of injection scripting from occurring. An approach to the IT staff at that office may well confirm that suspicion.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  9. #9
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    New Castle, PA
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yup - just got some contact names within the last few minutes! I'll post my findings - thanks again


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •