Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Cathal Please help! Filter dropdown list

Posted on 2014-03-05
5
Medium Priority
?
325 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 2000 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

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

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

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
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…
Suggested Courses

688 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