troubleshooting Question

Adding select value to this Spry (javascript) function

Avatar of Jason C. Levine
Jason C. LevineFlag for United States of America asked on
Web Languages and StandardsJavaScriptAJAX
18 Comments2 Solutions508 ViewsLast Modified:
Hi folks,

I've been staring at this for too long and it's driven me crazy.  I have a page that is filtering a Spry dataset based on checkboxes as demonstrated here .

What I would like to do is throw a select box up there instead of the checkboxes as I have too many options that can comfortably fit in checkboxes (all US States and Canadian Provinces).  

A simplified version of the HTML would be:

<select name="filterstate" onChange="ToggleFilter(this.value, ffState)">
   <option value="NY">New York</option>
   <option value="WI">Wisconsin</option>
</select>

and the javascript should look a little like this:

function ffState(ds, row, index){ return (row.state == ???) ? row : null };

function ToggleFilter(enable, f)
{
	if (enable)
		dsPrograms.addFilter(f, true);
	else
		dsPrograms.removeFilter(f, true);
}

What I can't figure out for the life of me is how to pass the selected value from filterstate into the above function where the ??? are.  Help!
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 18 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 18 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros