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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:11:42+00:00 2026-06-13T09:11:42+00:00

I am trying to use knockout.validation plugin. I created an exampleViewModel : function exampleViewModel()

  • 0

I am trying to use knockout.validation plugin. I created an exampleViewModel :

function exampleViewModel() {
   this.P1 = ko.observable().extend({ required : true });
   this.P2 = ko.observable().extend({ required : true });
   this.P3 = ko.observable().extend({ required : true });
   this.P4 = ko.observable().extend({ required : true });

   this.errors = ko.validation.group(this);
}    

In the above view model i created a validation group named errors for the current object. Now if any validation rule fails on any 1 property out of 4 than this errors property contains an error message.

My question is , if i want to create a validation group of only 3 properties (P1, P2, P3) out of 4 than how can i do 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-13T09:11:43+00:00Added an answer on June 13, 2026 at 9:11 am

    This worked well for me. Rather than grouping on this, create a proxy object that holds the properties you want validated.

    this.errors = ko.validation.group({
        P1: this.P1,
        P2: this.P2,
        P3: this.P3
    });
    

    If you do this, consider using validatedObservable instead of group. Not only do you get the errors, but you can collectively check if all the properties are valid using the isValid property.

    this.validationModel = ko.validatedObservable({
        P1: this.P1,
        P2: this.P2,
        P3: this.P3
    });
    
    // is the validationModel valid?
    this.validationModel.isValid();
    // what are the error messages?
    this.validationModel.errors();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use knockout.validation plugin. I want created a custom validation rule
I am trying to use knockout validation lib to validate an array of objects.
I'm trying to use the Knockout Concurrency plugin in my project, and I'm currently
I am trying to use this jquery color picker with knockout.js. I have written
I am need paint my image. I'm trying use JQuery in here this link:
Trying to use Powershell to script the removal of specific custom errors from an
I'm trying to attach validation to a mapped view. I'm using Knockout Mapping and
I am new to knockout, and trying to workout how to use validations. We
Been getting into Knockout and and slowly getting used to it. Trying to use
I'm trying use Places API from Google frmo a node.js server This is the

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.