Questions tagged [knockout-validation]

A plugin for knockout.js for declarative, rule-based validation of models and properties.

Knockout Validation allows for validation of knockout.js view model observables through extenders with:

The plugin also supports Asynchronous Validation.

Examples of such extensions include:

var myValue = ko.observable().extend({ required: true });
var myValue = ko.observable().extend({ max: 10 });
513 questions
0
votes
1 answer

Validating plain observableArray()

Assume my model is very simple (a list of strings), and I don't want to put typed objects into observableArray and then validate it using deep validation ko.validation.init( { grouping: { deep: true } } ). E.g. I want all array elements (which are…
Stas Slabko
  • 506
  • 5
  • 14
0
votes
1 answer

Knockout validation group undefined or unable to location errors in MVC

I'm trying to work on knockout and unable to validate using knockout validation plugin. [EDIT: update fiddle] sample fiddle: jsfiddle.net/EHDD8 var CustVM = function () { var self = this; self.name =…
Kalyan
  • 307
  • 2
  • 14
0
votes
1 answer

KnockoutJS check if on textbox is greater than another textbox

I am new to KnockoutJS and I am having some trouble with validation. I have two textboxes and I am trying to validate to ensure that textbox1 input value is greater than textbox2 input value.
Dashsa
  • 718
  • 8
  • 18
0
votes
1 answer

knockout validation user defined rules

I'm using knockout validation to validate a form. Each field has a custom set of rules. In my application an administrator should have the rights to chose some rules from a predefined set of rules for a specific field. I will have button for each…
Razvan
  • 3,017
  • 1
  • 26
  • 35
0
votes
1 answer

Knockout display all errors in one place

I just started to use the knockout validation plugin and I managed and I did manage to set up validation and from what I see the default behavior is to display for each validated property the errorMessage on it's right. What I would like to be able…
aleczandru
  • 5,319
  • 15
  • 62
  • 112
0
votes
1 answer

Validate field in observablearray not working (using knockout validation plugin)

I am using the knockout validation plug in and am trying to compare a date field in the observablearray to a static date. I know the code is not complete, but here is what i have- EDIT: VIEW CODE-
Chris
  • 795
  • 2
  • 12
  • 27
0
votes
1 answer

knockout validating multiple levels deep observable array

Hi I need to create a custom validator that will be aplyed for each element of an observable array using knockout validation plugin. The structure of my object will look something like this when I post it to the server: var viewModel = { …
aleczandru
  • 5,319
  • 15
  • 62
  • 112
0
votes
1 answer

Knockout-validation.js - setting required properties with jQuery fails validation

I've implemented a fairly common scenario in knockout.js, duplicating a form. The user fills out a "contact" form, and they are given the option to use the same values on a "billing" form by clicking a checkbox. That uses jQuery to iterate through…
Nick Silberstein
  • 833
  • 2
  • 8
  • 24
0
votes
1 answer

How to validate that a set of numbers across multiple models objects adds up to a specified value?

I'm using Knockout Validation to validate my model in a Durandal/KnockoutJS app. It's working fine, but I've run into a situation that I'm not sure how to handle. One of the things that users enter is a list of "instructors", and they can enter an…
Josh
  • 7,232
  • 8
  • 48
  • 75
0
votes
1 answer

Knockout Validation with Durandal JS firing on pageload regardless of messagesOnModified value

I'm working on a Durandal JS SPA application, and I wish to use Knockout Validation. The problem is that validation is being triggered on page load, which is not what I want - I'd like to trigger the validation myself. I have tried using …
Jeff
  • 12,085
  • 12
  • 82
  • 152
0
votes
3 answers

knockout is not showing error message span

I am using knockout validation and here is how my model looks like function SignInViewModel() { var self = this; self.userName = ko.observable('').extend({ required: true, pattern: { message: 'Username must be a…
Ancient
  • 3,007
  • 14
  • 55
  • 104
0
votes
0 answers

knockout validation IE 10

I have a simple form with submit button. Submit button is enabled/disabled based on weather there are client side validation errors. I use following to see if there are any errors. validationModel.errors().length For IE9, Chrome, and Safari this…
socialMatrix
  • 1,423
  • 5
  • 20
  • 36
0
votes
3 answers

Javascript iterating through a set of properties

Hi I have created a function object that contains a set of properties.This is what I have: function LoginModelDTO(data) { var self = this; self.UserName = ko.observable(data.UserName).extend({ minLength: { params: 25, …
aleczandru
  • 5,319
  • 15
  • 62
  • 112
0
votes
1 answer

How do I apply knockout validation inside foreach binding

My goal is to apply a knockout required validator on an input that is part of a collection on a viewmodel and made visible inside a foreach binding. Here's what I have so far - errors always evals to 0, not sure where I'm going wrong here. var…
MikeW
  • 4,749
  • 9
  • 42
  • 83
0
votes
1 answer

Knockout bindings getting lost in Durandal app

I have a SPA in which I am using Durandal / KnockoutJS with knockout.validation.js. Inside the {view}.js I have this set ko.validation.configure ({ decorateElement: true, registerExtenders: true, messagesOnModified:…
MikeW
  • 4,749
  • 9
  • 42
  • 83