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

  • SEARCH
  • Home
  • 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 8411733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:29:58+00:00 2026-06-10T00:29:58+00:00

I have a viewmodel (survey) that has a member (questions.current) which is an indexer

  • 0

I have a viewmodel (survey) that has a member (questions.current) which is an indexer pointing to the current question. Each question has a property (.text) that needs to be bound to the screen. Here is the scenario:

survey.questions.current.text
survey.questions.movenext()

I want the text on the screen to display the text value for the current question. As I move forward, I want this text to be automatically updated.

One way to handle it is to have an (ko.observable) survey.questions.currentText property that is automatically updated whenever a movenext or moveprevious function is executed. However, this may not be the cleanest approach as I have other values (including choices related to the individual question) that also need to be updated on the screen and I don’t want to have to create duplicates for each of the properties.

Making the text property an observable is not appropriate as the question text never changes. It is the currently selected question that is changed and that needs to trigger an update to the items on the screen.

What is the proper way to handle this?

  • 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-10T00:30:00+00:00Added an answer on June 10, 2026 at 12:30 am

    The with binding is one option, as demonstrated here, and in this fiddle. Since currentQuestion is an observable, the virtual element will update with it, even if the bindings are to non-observable properties.

    <!-- ko with: currentQuestion-->
        <span data-bind="text: text"></span>
    <!-- /ko -->​
    

    I didn’t know how you were actually changing the selection, so I just tied it to a select, but you can make the selection however you want.

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

Sidebar

Related Questions

I have a ViewModel which has a [key] property and i would like to
I have ViewModel, Which has a ObservableCollection[Employee] EmpCol , now that ViewModel is bind
I have a ViewModel class that implements the IDataErrorInfo Interface . In each property's
I have a viewmodel that includes a complex property of type TestThing which is
I have a ViewModel which exposes the string property PageToolBarVisible which can be true
I'm making a survey application. Survey has Questions and Questions have QuestionOption. haveThere is
I have a ViewModel class which has large number of properties(Say 50). Once the
I have ViewModel that has inside a Model and some extra properties. There are
I have following ViewModel (TripSearchView) which contains IEnumerable(of AffiliateComponentTypeView) property, I have to populate
I have a ViewModel that holds Date, Hour and minute as a string, each

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.