Solved

Cathal Please help! Filter dropdown list

Posted on 2014-03-05
5
318 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 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to show span when clicked on? 10 24
asp.net mvc5 6 17
How can I make a javascript to show drop down 4 20
Html form and modal / img src -problem 3 12
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 …
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…
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…

832 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