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 8418309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:17:19+00:00 2026-06-10T02:17:19+00:00

Can anyone please help, or give me a nudge on how to move forward

  • 0

Can anyone please help, or give me a nudge on how to move forward with this.

I am trying to work with KnockoutJS to put together a sample app (I’m learning both MVC and trying to learn jQuery/Knockout).

The sample is based on the Cart example in the Knockout training docs – my copy/version of it is here:

JsFiddleExample

The JSON is fairly straighforward:

[{
    "occ": [
    {
        "name": "1 Room only",
        "price": 53.9},
    {
        "name": "1 B&B",
        "price": 62.16}, ],

    "TypeName": "Single",
    "TypeID": "3121",
    "TypeCount": "2"
    },
{
    "occ": [
    {
        "name": "2 B&B",
        "price": 24.23},
    {
        "name": "2 DBB",
        "price": 32.95}],

    "TypeName": "Double",
    "TypeID": "4056",
    "TypeCount": "2"
    }......

So the first drop down is linked to “TypeName” and “TypeID”.

When a selection is made from that, the Occ (2nd drop down) shows the offers available for that room (eg. 2 DBB @ 32.95).

There is a text box currently, where you can enter the quantity that you would like – however, I would like that to either be limited to a number, up to “TypeCount” in the JSON – or even better, to have another drop down, which has numbers up to “TypeCount”.

If possible, I would also like to limit what is shown if “Add Room” is clicked, and another line is added – so I don’t want to see any room types already selected in lines above, in the drop down list on the next line.

Thank you for any pointers,

Mark

  • 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-10T02:17:21+00:00Added an answer on June 10, 2026 at 2:17 am

    Knockout includes a utility called ko.utils.range and you can give it a starting and ending value. You could use this to create an array of options that goes from 1 to your TypeCount.

    There are several ways to write it, but here is one example:

    <td class='quantity' data-bind="with: category">
        <select data-bind="visible: $parent.product, options: ko.utils.range(1, TypeCount), value: $parent.quantity"></select>
    </td>
    

    Updated fiddle: http://jsfiddle.net/rniemeyer/3t6hP/4/

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

Sidebar

Related Questions

Can anyone please help me to work out how to achieve the following? I
Can anyone please help me to add video controls (play, pause, forward, seekbar) to
Can anyone please help me with this...I'm not very good with regular expressions and
Can we add image together with text in a picker view? Anyone please help!
Here I am again asking for help. Can anyone please show me a sample
Can anyone please help me to know how to open an excel sheet in
Can anyone please help me to understand how should i access json data in
Can anyone please help. I'm following a tutorial found here as I have a
Can anyone please help me how to convert string to date I have 3
I'm a new bie with MVC3 razor. Can anyone please help me why I

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.