Questions tagged [custom-validators]

234 questions
51
votes
9 answers

How add Custom Validation Rules when using Form Request Validation in Laravel 5

I am using form request validation method for validating request in laravel 5.I would like to add my own validation rule with form request validation method.My request class is given below.I want to add custom validation numeric_array with field…
gsk
  • 2,329
  • 8
  • 32
  • 56
25
votes
5 answers

How to test a Validator which implements ConstraintValidator in java?

I have an "AllowedValuesValidator.java" class: public class AllowedValuesValidator implements ConstraintValidator { String[] values; String defaultValue; @Override public void initialize(AllowedValues…
goe
  • 1,153
  • 2
  • 12
  • 24
14
votes
1 answer

Inject custom service into a custom Validator

I'm trying to make a custom Angular 2 form Validator to check if a user exist on a data base. This is the code of my custom form Validator import { FormControl } from '@angular/forms'; import {API} from "../services/api"; import {ReflectiveInjector}…
Hanzo
  • 1,839
  • 4
  • 30
  • 51
13
votes
1 answer

Want to allow options to be specified multiple times when using boost program options. Right now I get multiple occurrences

I am using boost program_options 1.50.0 I want to ALLOW the following for my program foobar foobar --debug 2 --debug 3 From the boost program_options code, there is an example regex.cpp that shows creating a new type and creating a validator for…
Matt Frazer
  • 177
  • 1
  • 7
12
votes
1 answer

Angular Custom Async Validator returning {__zone_symbol__state: null, __zone_symbol__value: Array(0)}

Am trying to implement custom validators. The non-async one (cannotContainSpaces) works just fine. The async one (shouldBeUnique), which, yes, is trivial at the moment, should be returning promise as I understand, which the Validator object should…
PakiPat
  • 1,020
  • 14
  • 27
11
votes
2 answers

How to write a unit test case for a custom validator for angular reactive forms?

I have a custom model-driven form validator to validate maximum text length export function maxTextLength(length: string) { return function (control: FormControl) { const maxLenghtAllowed: number = +length; let value: string =…
10
votes
1 answer

multiple custom validators in reactive form angular 2

I have two custom validator in a reactive form, I call function below to create form in component constructor: private createForm(): void { this.passwordUpdateForm = this.formBuilder.group({ newpassword : [null, Validators.required], …
9
votes
3 answers

How to use custom validators of github.com/1000hz/bootstrap-validator

From the documentation http://1000hz.github.io/bootstrap-validator/: Add custom validators to be run. Validators should be functions that receive the jQuery element as an argument and return a truthy or falsy value based on the validity of the…
leo
  • 135
  • 1
  • 1
  • 6
9
votes
1 answer

CustomValidator not working well

I have the following piece of asp: ...
RanH
  • 740
  • 1
  • 11
  • 31
7
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,…
7
votes
2 answers

Angular4: Form invalid despite no errors in fields (using custom validation)

I'm trying to validate a form using custom validation. For some reason I have to build a form that can change either E-Mail or set a new Password. For that reason I cannot use Validators.required as password fields become only required when they are…
Carsten Ennulat
  • 156
  • 1
  • 9
7
votes
1 answer

vee-validate Custom validation rules not working

Versions: VueJs: 2.2.6 Vee-Validate: ^2.0.0-beta.25 Description: I am working on a project, where I use laravel-vue-starter as a base template. I wants to use a custom validation for password. So I created a…
Abu Sufian
  • 157
  • 1
  • 11
7
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,523
  • 2
  • 20
  • 40
7
votes
1 answer

How do I use an existing Rails validator within a custom validation method?

I would like to create a custom validation method within my model and use some existing validators (specifically, validates_numericality_of) within the custom validation method. Is this possible? If so, how do I do it? For some context: We are using…
nc.
  • 7,179
  • 5
  • 28
  • 38
7
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
  • 71
  • 1
  • 4
1
2 3
15 16