Solved

Cathal Please help! Filter dropdown list

Posted on 2014-03-05
5
322 Views
Last Modified: 2014-03-05
my ErrorHi,

I am filtering my data.  
I have to filter by Segment, Industry and company.

the SelectedCompany has a value of "object Object], 279425"

but it should be like this:

SelectedCompany = "279425"

the option list is like this: "4,5010,279415"


function setGroupOptions()
	{
		var	SelectedSeg=""	
		var	SelectedIndustry=""	
		var	SelectedCompany=""	
		var dropdownGroup = $("#DispGroupList");
		var SelectedCompany = $("#DispCompanyList option:selected");

		$('#DispCompanyList option:selected').each(function() {
    		vals = $(this).val()
    		vals=vals.split(",")
    		SelectedSeg+= "," + vals[0]
			SelectedIndustry += "," + vals[1]
			SelectedCompany += "," + vals[2]
   		})
			SelectedSeg = SelectedSeg.substring(1)
			SelectedIndustry = SelectedIndustry.substring(1)
			SelectedCompany = SelectedCompany.substring(1)
			
		$.get( "filterGroup.cfm?filter=1&SelectedSeg=" + SelectedSeg + "&SelectedIndustry=" + SelectedIndustry + "&SelectedCompany=" + SelectedCompany, function (data) {
			dropdownGroup.html( data );
		});
	}

Open in new window

error.png
0
Comment
Question by:lulu50
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 39906768
Can you post the dropdown HTML.
0
 

Author Comment

by:lulu50
ID: 39906935
<select name="DispCompanyList" class="SearchBySelect5" id="DispCompanyList" style="background-color: #f8fafc; width: 250px; height: 500px;" onchange="setGroupOptions();" size="180" multiple="multiple" sizzle-1394033742195="[object Object]">

<option value="5,8690,279780" data-CompanyCode="279780">
5,8690,279780(MICHIGAN FARM BUREAU - MEDIGAP OPT A & C)
</option>

<option value="5,8690,275056" data-CompanyCode="275056">
5,8690,275056(MICHIGAN FARM BUREAU MEDICARE & COMPREHENSIVE)
</option>

<option value="5,8690,116591" data-CompanyCode="116591">
5,8690,116591(MICHIGAN FARM BUREAU MEMBERS)
</option>

<option value="4,8630,278806" data-CompanyCode="278806">
4,8630,278806(UAW RETIREE MEDICAL BENEFITS TRUST)
</option>

</select>

Open in new window

0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
ID: 39906989
You need to change your naming
You are assigning SelectedCompany to an object
var SelectedCompany = $("#DispCompanyList option:selected");

So you cannot use it as a string later on
SelectedCompany += "," + vals[2]

Though this
var SelectedCompany = $("#DispCompanyList option:selected");

is never used from what you have posted, so you might be able to just delete it. Possibly a remnant from how you were trying to do it?
0
 

Author Comment

by:lulu50
ID: 39907148
Cathal,

Thank you it works!!

but I have a different issue, I will post it

I will create a different post
0
 

Author Closing Comment

by:lulu50
ID: 39907150
Thank you
0

Featured Post

Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month11 days, 14 hours left to enroll

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question