1

Here's the deal. I have built a site to market lumber handling products our company sells, and it works great in Firefox, Chrome, etc. In IE (7, 8 and 9), rendering is fine, but there is one peculiar issue with our quote form.

When a user is browsing the site and they see something they like, they can hit "add to quote request" and it will add it to the quote request in their current session. If they want to review or finish their request, they have the things they were interested in preselected. Here is a screencast showing intended behavior:

http://screencast.com/t/YPSbWjVe

I'm requesting http://lumberhandling.com/quote via jquery $.get to grab the form.

Here is a screencast of the same activity in IE9:

http://screencast.com/t/3jRHSLUjC

I do exactly the same thing, but if I click the quote request button and the modal is activated, I am "stuck" with whatever was checked in the modal the first time. I cannot update the modal content until I actually type the quote url in my address bar and go to the fallback page http://lumberhandling.com/quote

I've even tried forcing a check to ensure that items which are selected (these are stored in db sessions) get selected:

function checkQuoteItems()
{
    $(document).bind('cbox_complete', function() 
    {
        $.getJSON("/quote/check_quote_items", function(json) {
            $(json.items).each(function(index, value)
            {
                var solution = 'solution_'+value;
                $('.checkbox[name="'+solution+'"]').attr('checked', 'checked');
            });
        });
    });
}

Sadly, no dice in IE. Can anyone point me in the right direction on debugging this? I am kind of bewildered.

Calvin Froedge
  • 16,135
  • 16
  • 55
  • 61
  • 1
    Have you verified that the correct data is coming back in IE? (log the values in your getJson request) – John Kalberer Aug 04 '11 at 22:58
  • 1
    Make sure to take full advantage of IE's dev tools. Hit F12 in IE to pull them up. You can set breakpoints and step through your JavaScript, and examine network traffic. With those tools you should be able to better understand your problem. – gilly3 Aug 04 '11 at 23:05
  • Thanks for the comments, guys. I was under the impression console.log didn't work in IE, but this post http://stackoverflow.com/questions/690251/what-happened-to-console-log-in-ie8 says otherwise. I'll make sure to check it out. Thanks for the feedback! – Calvin Froedge Aug 05 '11 at 02:48

2 Answers2

1

I figured out my issue. The problem was that the URL of the form was getting cached in IE. I used an ajax request with cache set to false in order to resolve.

function checkQuoteItems()
{
    $(document).bind('cbox_complete', function() 
    {
        $.ajax({
              url: "/quote/check_quote_items/string",
              cache: false,
              type: "GET",
              dataType: "json",
              success: function(json){
                    if(json.items != null)
                    {
                        $(json.items).each(function(index, value)
                        {
                            trace(value);
                            $('.checkbox[name="solution_'+value+'"]').attr('checked', true);
                        });
                    }      
              }
          });

    });
}
Calvin Froedge
  • 16,135
  • 16
  • 55
  • 61
0

I hope checkbox is a classname applied to the checkbox elements. You can try this

function checkQuoteItems()
{
    $(document).bind('cbox_complete', function() 
    {
        $.getJSON("/quote/check_quote_items", function(json) {
            $(json.items).each(function(index, value)
            {
                $('.checkbox[name=solution_"'+value+'"]').attr('checked', true);
            });
        });
    });
}
ShankarSangoli
  • 69,612
  • 13
  • 93
  • 124