/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] IE Browser Select Box Issue (MooTools)

mediasource.saymikeo.com

At the bottom of this page, click the web or video big white box. Then turn your attention to the select boxes.

When you select either of the first two choices, another box should pop up next to the select box. That box should populate with other choices.

  • 1. My problem is the secondary box does not populate with the correct data.

  • 2. When you select option 3 or 4 the box should disappear.
  • This works in Firefox. This is done through a JSON call in Mootools.

    If you can figure this out I will think you are totally awesome. First for going through my messy code and second for being able fix it.

    Your assistance is greatly appreciated.

    This is the base function that calls view_category() which calls add_select_box();

    [CODE]
    function build_page(url, id){
    $(‘ajax_box’).set(‘html’, ”);
    dbug.log(‘Obj URL: ‘, id, url);
    // Get the requested view
    var view = new Request.JSON({
    url: url, onSuccess: function(jsonObj){
    view_category(jsonObj.selectbar, id);
    }
    }).send().chain(function(){
    new Fx.Tween(service).start(‘opacity’, ‘1’);
    });
    }
    [/CODE]

    This is the view_category function. Its purpose is to build everything below the select box. It calls the add_select_box.

    [CODE]
    // Viewing the Title, Description and sub descriptions
    function view_category(oSelect, id){
    add_select_box(oSelect, id);
    oSelect.each(function(oOptions){
    if(oOptions.id == id){
    var service_type = new Element(‘div’, {id: oOptions.id, ‘class’: ‘sub_choice’}).inject($(‘ajax_box’), ‘bottom’);
    oOptions.options.each(function(oSub){
    var blank_div = new Element(‘div’).inject(service_type, ‘bottom’); // Needed for the Expand Link to work
    var service_title = new Element(‘h2’).set(‘html’, oSub.title).inject(blank_div, ‘bottom’); // Title
    var service_description = new Element(‘p’).set(‘html’, oSub.description).inject(blank_div, ‘bottom’); // Description
    var expand = new Element(‘div’, {‘class’: ‘expanding’}).inject(blank_div, ‘bottom’); // Expanding Sub Box
    if(oSub.sub != undefined){
    // Expanding and Colapsing Link
    var service_elink = new Element(‘a’, {href: ‘javascript:void(0)’, onclick: ‘expand(this); return false’}).set(‘html’, ‘more’).inject(service_description);
    oSub.sub.each(function(oSubOptions){
    var sub_div = new Element(‘div’).inject(expand, ‘bottom’);
    var sub_title = new Element(‘h3’).set(‘html’, oSubOptions.title).inject(sub_div, ‘bottom’); // Sub Title
    var sub_description = new Element(‘p’).set(‘html’, oSubOptions.description).inject(sub_div, ‘bottom’); // Sub description
    if(oSubOptions.sub_description != undefined){
    var sub_elink = new Element(‘a’, {href: ‘javascript:void(0)’, onclick: ‘expand(this); return false’}).set(‘html’, ‘more’).inject(sub_description);
    var sub_expanding = new Element(‘div’, {‘class’: ‘expanding’}).inject(sub_div, ‘bottom’); // Sub Sub Expanding
    var sub_sub_description = new Element(‘p’).set(‘html’, oSubOptions.sub_description).inject(sub_expanding, ‘bottom’); // Sub Sub Description
    };
    });
    };
    });
    }
    });

    };
    [/CODE]

    This code adds the select box and changes the select box when the select button is changed.

    [CODE]
    function add_select_box(oSelect, id){
    var select_box = new Element(‘div’, {id:’select_box’}).inject($(‘ajax_box’));
    var formSelectVar = new Element(‘select’);
    oSelect.each(function(item){
    if(item.id == id){
    var continue_div = new Element(‘div’, {id:’continue’}).inject(select_box);
    new Element(‘a’, {href:’javascript:void(0)’}).inject(continue_div);
    if(item.id == id){
    // Create each option for the first select box
    item.options.each(function(myArray){
    var formOption = new Element (‘option’).set(‘html’, myArray.title).inject(formSelectVar);
    });
    new Element(‘option’, {selected:’selected’}).set(‘html’, ‘Choose’).inject(formSelectVar, ‘top’);
    formSelectVar.inject($(‘select_box’), ‘top’ ); // This is the First Select Box
    $(‘ajax_box’).getElement(‘select’).addEvent(‘change’, function(){// Listen for the select box to change
    var categoryValue = $(‘ajax_box’).getElement(‘select’).value;
    if($(‘sub_select’)){
    var formSelectVar = $(‘sub_select’).set(‘html’, ”);
    }else {
    var formSelectVar = new Element(‘select’, {id:’sub_select’});
    }
    // Make a secondary select box for additional options
    var notdefined;
    item.options.each(function(myArray){
    if(myArray.sub != undefined && myArray.title == categoryValue){
    dbug.log(‘Secondary Select: ‘, myArray.sub, myArray.title, categoryValue)
    myArray.sub.each(function(subArray){
    var formOption = new Element (‘option’).set(‘html’, subArray.title).inject(formSelectVar);
    });
    notdefined = false;
    }else if(myArray.title == categoryValue){
    dbug.log(‘Else Dialoge: ‘, myArray.sub, myArray.title, categoryValue)
    notdefined = true;
    }
    });
    dbug.log(‘Not Defined: ‘, notdefined);
    if(notdefined != true){
    new Element(‘option’, {selected: ‘selected’}).set(‘html’, ‘Choose’).inject(formSelectVar, ‘top’);
    formSelectVar.inject($(‘select_box’)); // This is the second select box
    }else{
    formSelectVar.dispose();
    }
    });
    };
    }
    });
    };
    [/CODE]

    to post a comment
    JavaScript

    6 Comments(s)

    Copy linkTweet thisAlerts:
    @FangAug 26.2010 — The select options do not have values which are necessary for IE to send a selected value. I would expect MooTools to fix this, but without having read your code, perhaps this is the root of the problem.
    Copy linkTweet thisAlerts:
    @styks1987authorAug 26.2010 — ok thanks! I will test that today.

    Mike
    Copy linkTweet thisAlerts:
    @styks1987authorAug 26.2010 — You are the man fang! Thank you so much! It is always something so small...
    Copy linkTweet thisAlerts:
    @styks1987authorAug 28.2010 — I do not know much about pre loaders but the page loaded fine for me in IE 8.

    Mike
    Copy linkTweet thisAlerts:
    @styks1987authorAug 28.2010 — Sorry, I saw the email then forgot about it!

    Here are screen shots from IE8 and IE6. I do not have IE7.

    Mike

    [upl-file uuid=8b012d83-fd4f-4b88-a260-5da19876ccb1 size=92kB]ie6.jpg[/upl-file]

    [upl-file uuid=22ddb252-9b93-4bc8-85c4-07aeead1c08d size=99kB]ie8.jpg[/upl-file]
    Copy linkTweet thisAlerts:
    @FangAug 29.2010 — Sorry, I saw the email then forgot about it! [/QUOTE]?
    Here are screen shots from IE8 and IE6. I do not have IE7.[/QUOTE] If you have IE8 you have IE7: http://msdn.microsoft.com/en-us/library/dd565628%28VS.85%29.aspx#bdmodes
    ×

    Success!

    Help @styks1987 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...