Solved

Cathal Please help! Filter dropdown list

Posted on 2014-03-05
5
315 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
  • 3
  • 2
5 Comments
 
LVL 58

Expert Comment

by:Gary
Comment Utility
Can you post the dropdown HTML.
0
 

Author Comment

by:lulu50
Comment Utility
<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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
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 the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now