Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Cathal Please help! Filter dropdown list

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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

916 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