dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] Dropdown depending on another dropdown does not fire

  1. #1
    Join Date
    Sep 2017
    Location
    Haddon Heights NJ
    Posts
    60

    resolved [RESOLVED] Dropdown depending on another dropdown does not fire

    I have a page that shows different document depending on 3 selection facility, growers and product. Products is not implemented yet as i have a problem with the second selection. The grower selection depend on the facility selection, in other words there are different grower for each facility. Selecting the facility, the Jquery reloads the dropdown for growers, that works fine including the updateScreen that shows the correct information. My problem is with the second selection marked "this call" on the code. Doesn't matter where i put that piece of code the call is not made (you see i have an alert there).
    I tried putting it at the end of the updateScreen but still did not work. Any ideas how to make that call work? Thanks for the help.


    Code:
    $(document).ready(function(){
        updateScreen();
        getGrowers();
    
    });
    $("#closeWindow").click(function(){
        $("#informacionEmpaque").fadeOut();
    });
    $("#facility").on('change',function(){
        updateScreen();
        }
    );
    $("#grower").on('change', function(){  //<<<<---- This call
        alert('here');
        updateScreen();
    });
    function updateScreen(){
        $("#receivedDocs").load("/supplier/receivedDocuments.php",{
    	approved:0,
    	facilityID:$("#facility").val(),
    	growerID:$("#grower").val(),
    	productID:$("#product").val()
    	},function(data,status){
    	    $("#receivedDocs button").click(function(){
    		approveDocuments($(this).val());
    	    });		    
    	    console.log("receivedDocuments:"+status);
    	    $("#receivedDocs tr").click(function(e){
    		if(e.target.className === 'fa fa-handshake-o'){return;}
    		$(this).addClass('highLight');
    		$(this).siblings().removeClass('highLight');
    		showDocument($(this).find('td:first').text(),$(this).find('td:nth-child(2)').text());
    	    });
        });
        $("#approvedDocs").load("/supplier/receivedDocuments.php",{
    	approved:1,
    	facilityID:$("#facility").val(),
    	growerID:$("#grower").val(),
    	productID:$("#product").val()
    	},function(data,status){
    	    console.log("approvedDocuments:"+status);
    	    $("#approvedDocs tr").click(function(){
    		$(this).addClass('highLight');
    		$(this).siblings().removeClass('highLight');
    		showDocument($(this).find('td:first').text(),$(this).find('td:nth-child(2)').text());
    	    });			
        });
        getGrowers();
    }
    function getGrowers() {
        $("#growers").load("/supplier/getGrowers.php",{
    	facilityID:$("#facility").val()
        });
    }

  2. #2
    Join Date
    Sep 2017
    Location
    Haddon Heights NJ
    Posts
    60
    Im sorry to waste your time, it was a spelling mistake. The variable for the dropdown was "growers" and not "grower" , now is working fine.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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