Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7971505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:39:17+00:00 2026-06-04T07:39:17+00:00

I am trying to build a three step drop down series. Easiest example I

  • 0

I am trying to build a three step drop down series. Easiest example I could think of was building a year/make/model drop down set.

I have tried following the example at and using another fiddle at (another fiddle url ending with jsfiddle.net/rniemeyer/V2gvT/ ), but am having problems with the databinding.

My fiddle has a static list of year/make/model objects to use, and the year list binds properly, but never get the make/model lists to databind.

My Fiddle

Simple Markup

<label for="ddlYear">Year</label>
<select id="ddlYear" data-bind="options: years, value: selectedYear"></select>

<label for="ddlMake">Make</label>
<select id="ddlMake" data-bind="options: makes, value: selectedMake'"></select>

<label for="ddlModel">Model</label>
<select id="ddlModel" data-bind="options: models"></select>

Script

var viewModel = {
    selectedYear: ko.observable(""),
    selectedMake: ko.observable(""),
    selectedModel: ko.observable("")    
};

viewModel.years = ko.dependentObservable(function() {
    return Enumerable.From(makeModelList).Select(function(it) {
      return it.year;
    }).OrderBy(function(it) {
      return it.year;  
    }).Distinct().ToArray();
}, viewModel);

viewModel.makes = ko.dependentObservable(function() {
    var selectedYear = this.selectedYear();
    return Enumerable.From(makeModelList).Where(function(it) {
        return it.year == selectedYear;
    }).Select(function(it) {
      return it.make;  
    }).ToArray();
}, viewModel);

viewModel.models = ko.dependentObservable(function() {
    var selectedYear = this.selectedYear();
    var selectedMake = this.selectedMake();
    return Enumerable.From(makeModelList).Where(function(it) {
        return it.year == selectedYear;
    }).Where(function(it) {
      return it.make == selectedMake;  
    }).Select(function(it) {
      return it.model;  
    }).ToArray();
}, viewModel);

ko.applyBindings(viewModel);

Data is defined in the script block window

var makeModelList = [
{
    year: 1984,
    make: 'Chevrolet',
    model: 'Camaro'},

etc.

Tried to make it as simple as I could, but can’t quite figure out why the selects are databinding like the examples I’ve tried to mimic.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:39:18+00:00Added an answer on June 4, 2026 at 7:39 am

    You have unnecessary ‘ in this line (after word selectedMake):

    <select id="ddlMake" data-bind="options: makes, value: selectedMake'"></select>
    

    just remove it.

    fixed fiddle – http://jsfiddle.net/Yrkbd/8/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a VB project which I'm trying to configure with three build configurations.
I'm trying to build an expression tree ( still ) but getting further! I
I am trying to build a Quadtree data structure(or let's just say a tree)
I'm trying to see if there is a way to build a Linq statement
I'm trying build a method which returns the shortest path from one node to
I'm trying build an App Engine connected Android application and am having some problems
I'm trying build a MVC framework, but I'm confused about manage themes. Well... I
Trying to build sslsniff on a RHEL 5.2 system here. When compiling sslsniff on
Trying to build Xuggler under Windows. Xuggler is core native code functions wrapped into
Trying to build my project with ANT in idea 10 and I get a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.