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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:55:49+00:00 2026-06-09T17:55:49+00:00

How can I do the following validation using knockout js? I have the following

  • 0

How can I do the following validation using knockout js? I have the following view model:

function ViewModel () {
        var self = this;
        self.ListName = ko.observable();
        self.Current = ko.observable();
        self.MyVideos = ko.observableArray();
    }

Where MyVideos have the following structure:

    [{
                "VideoID": 1,
                "VideoName": "First Video"
    },
    {
                "VideoID": 2,
                "VideoName": "First Video"
    }]

So Current and VideoId are the relation, and I want to render the VideoName with the self.Current value.

  • 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-09T17:55:50+00:00Added an answer on June 9, 2026 at 5:55 pm

    It sounds like Current is the VideoId and you want to display the VideoName. For that scenario you could do:

    self.CurrentName = ko.computed(function() {
        var currentId = self.Current();
    
        var currentVideo = ko.utils.arrayFirst(self.MyVideos(), function(video) {
            return currentId === video.VideoId; 
        });
    
        return currentVideo ? currentVideo.VideoName : 'none';
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jQuery Validation Plugin (http://bassistance.de/jquery-plugins/jquery-plugin-validation/) I have wrote following rule jQuery.validator.addMethod(valueNotEquals, function(value,
I have a validator which I can enable or disable using the following javascript:
I have the following code block for validation in PHP and I can't figure
I am using the following javascript for form validation: <script type=text/javascript> function validate_form (
I am using paperclip to accept image uploads. I have the following validation on
In a model say Task , I have following validation validates_presence_of :subject, :project, :user,
I have the following php code using the codeigniter framework $this->form_validation->set_rules('money', 'Money', 'integer|required|xss_clean'); It
I am using jQuery validation plugin ( http://bassistance.de/jquery-plugins/jquery-plugin-validation/ ) I have following structure: <select
How can the following function be implemented in various languages? Calculate the (x,y) point
In a htmlpage using jQuery or JavaScript how can the following be achieved? User

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.