Questions tagged [custom-validators]

236 questions
5
votes
1 answer

Angular forms custom validator null return not removing error from form

So I've created a custom validator to verify that the confirm password input matches the original entry. Works fine. However, I'm allowing that both fields be blank since this is on a page where someone can change their password in their settings,…
5
votes
1 answer

is there a way to add violation to multiple paths in symfony2?

is it possible to add a violation to multiple paths? like: $this->context->buildViolation($constraint->message) ->atPath('initialDate') ->atPath('finalDate') ->addViolation(); it only add…
jbrunoxd
  • 213
  • 1
  • 4
  • 14
5
votes
1 answer

Why must JSR303 custom annotation's constrain group default to empty array?

I'm writing a custom validator for a specific constrain group (not Default), but the runtime gives me the below error. I'm just curious why they need the default values to be empty. Appreciate if you can share your opinion. Thanks…
The Huy
  • 51
  • 1
  • 4
4
votes
2 answers

custom validation attribute not working on client, just on server

I am trying to implement custom attribute validation, similar to one demonstrated here in ScottGu's blog: http://weblogs.asp.net/scottgu/archive/2010/01/15/asp-net-mvc-2-model-validation.aspx I have this custom validator attribute for Email: public…
4
votes
3 answers

Does custom validator works in FormView?

I have search through google and found that a lot of people is struggling with this issue but i still not found the right answer. http://i.stack.imgur.com/15jen.png I have a form view and need to check that if the language code is duplicate or not,…
Sarawut Positwinyu
  • 4,544
  • 13
  • 47
  • 71
4
votes
1 answer

Angular 6: Cannot read property 'get' of undefined

I am practicing with Angular and I have a problem when I try to use "Build-in Validators". I try to pass as a parameter the value of a form field, but when I try to do it I simply have the error that I put in the title "Can not read property 'get'…
Ricky
  • 1,306
  • 2
  • 20
  • 34
4
votes
2 answers

custom validation acces form components

I want to make a custom validation for angular2. This validation must access another component of the form. Is this possible? My template
lordkain
  • 2,863
  • 1
  • 11
  • 17
4
votes
2 answers

Angular Forms reactive - cross-control validation

I'm working on a validator for a reactive form in angular 5, and having difficulty setting a validator that is based on the value of another input. The form looks something like this: let myRules = new…
toms
  • 497
  • 5
  • 21
4
votes
1 answer

When using @AssertTrue in methods, the method is invoked 4 times during validation (Bean Validation)

When using bean validation to validate the state of an object, the method annotated with @AssertTrue is called 4 times whenever the validation is invoked. It should only be called once per invocation. Hibernate-validator version: 5.1.3.Final Here is…
4
votes
2 answers

Testing custom validators with Minitest

I have multiple models with email validation. Therefore I've extracted the validation into a custom validator. I dit this by following the tutorial of the Rails Guides. class EmailValidator < ActiveModel::EachValidator def validate_each(record,…
Tobias
  • 4,054
  • 2
  • 15
  • 36
4
votes
1 answer

Custom Validation Attribute with Custom Model Binder in MVC 2

I apologise for the amount of code I have included. I've tried to keep it to a minimum. I'm trying to have a Custom Validator Attribute on my model as well as a Custom Model binder. The Attribute and the Binder work great seperately but if I have…
griegs
  • 22,002
  • 28
  • 113
  • 201
4
votes
0 answers

How to set FieldError field in a custom jsr 303 validation

I am creating a webservice in spring. I have a Params DTO which is nested in my OtherParentDTO's. Each request may contain only certain fields in the params Dto. If the fields are present then I need to do a validation(basically null check). In the…
4
votes
2 answers

Warning: No message defined for

I get this error message on a textbox field when I want to validate its form. There is a requiredif validation attribute on this field, but this field is a clone of its original. I changed all properties of it and even its rules also…
Sándor Hatvani
  • 405
  • 1
  • 6
  • 15
4
votes
1 answer

Testing custom validation functions independently of models in rails app

I'm building a custom validation method for use in my rails app. The type of validator I want to build compares a column in the model where the validator is called to columns in other tables. The following is a code example that illustrates the…
4
votes
1 answer

Web2py Custom Validators

I am new to Web2py and am trying to use a custom validator. class IS_NOT_EMPTY_IF_OTHER(Validator): def __init__(self, other, error_message='must be filled because other value ' 'is present'): …
Rahul Bhatia
  • 887
  • 2
  • 10
  • 16
1
2
3
15 16