Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Firefox bug - Multiple dropdown content changing with previous selection

    Hi guys,

    I have this system of multiple dropdowns which hold questions. The second dropdown content changes depending what you selected in the first one, and the 3rd one will change depending what you selected in the 2nd and so on.. until you get an answer, at which point a result is displayed.

    This works fine in most browsers (minus a few erros in IE which aren't a massive issue at the moment.)

    The problem is in Firefox. When you select something from a dropdown in firefox, it doesnt just look at the next dropdown, it will go through all the dropdowns and end up going straight to an answer!

    Here's a link with the system on, and a link to the scripts page too. Any help you can shed on this would be appreciated! I can't work out what firefox doesnt just read the next dropdown like all the other browsers, and instead jumps through all of them.

    Here is a link to the website - http://showerpumpselector.co.uk/shower-pump-selector/

    Here is the script that handles how the dropdowns get their values, and how it picks the correct answer to display:

    Code:
    // Pump Selector& Fault finder - Display next question
    function cascadeSelect(parent, child){
         var childOptions = child.find('option');
         child.data('options',childOptions);
    
         parent.change(function(){
    
         childOptions.remove();
         child
         .append(child.data('options').filter('.sub_' + this.value))
         .change();
    })
    	
    childOptions.not('.static, .sub_' + parent.val()).remove();
    
    }
    		
    $(function(){
    cascadeForm = $('.cascadeTest');
    q1Select = cascadeForm.find('.q1Select');
    q2Select = cascadeForm.find('.q2Select');
    q3Select = cascadeForm.find('.q3Select');
    q4Select = cascadeForm.find('.q4Select');
    q5Select = cascadeForm.find('.q5Select');
    q6Select = cascadeForm.find('.q6Select');
    			
    cascadeSelect(q1Select, q2Select);
    cascadeSelect(q2Select, q3Select);
    cascadeSelect(q3Select, q4Select);
    cascadeSelect(q4Select, q5Select);
    cascadeSelect(q5Select, q6Select);
    });
    		
    
    // Pump selector and fault finder
    $('select').change(function() {
    										
    $(this).parent().nextAll('.selector').hide();
    $(this).parent().nextAll('.selector select').val("");
    
    var getval = $(this).val();
    var refsplit = getval.split('-');
    var ref1 = refsplit[0];
    var ref2 = refsplit[1];
    		 							 
    if (ref1 == "answer") {            
      $('.result').hide();
      $('.result.answer-' + ref2).fadeIn('slow'); 
    }
    else {
      $('.result').fadeOut('slow');
      $(this).parent().first('select').fadeIn('slow');	
    }
    		 
    });

  • #2
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,949
    Thanks
    9
    Thanked 724 Times in 718 Posts
    What version of Firefox are you using to test? When I use FF9 the dropdowns appear to work correctly in sequence.

  • #3
    New to the CF scene
    Join Date
    May 2011
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hi there, I was using v8 but just upgraded to 9 however it is still doing it.

    http://www.showerpumpselector.co.uk/...pump-selector/

    If you select Large Domestic / Light Commercial for the first dropdown, it flys through all the options and outputs an answer straight away.

    Not sure if there's a better/another way of achieving what I'm after, been pulling my hair out over this for some time now.

  • #4
    Senior Coder
    Join Date
    Feb 2009
    Location
    Ilkley, West Yorkshire, UK
    Posts
    2,949
    Thanks
    9
    Thanked 724 Times in 718 Posts
    You're right, it does. I selected the "Domestic" option, in which case it seems OK.


  •  

    Tags for this Thread

    Posting Permissions

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