Questions tagged [custom-validators]
236 questions
45
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…
![](../../users/profiles/4617250.webp)
gsk
- 2,119
- 4
- 25
- 53
35
votes
3 answers
Display custom validator error with mat-error
I come to you for talking about a problem with angular material. In fact, I think it's an issue, but I prefer looking for a misunterstanding first.
The first thing about my problem is the context, i try to do a simple form containing two inputs : a…
![](../../users/profiles/7256369.webp)
Pouette
- 353
- 1
- 4
- 8
21
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…
![](../../users/profiles/3817503.webp)
goe
- 1,083
- 2
- 11
- 21
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}…
![](../../users/profiles/2781852.webp)
Hanzo
- 1,677
- 3
- 20
- 44
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…
![](../../users/profiles/5937542.webp)
PakiPat
- 820
- 7
- 23
11
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…
![](../../users/profiles/1724349.webp)
Matt Frazer
- 157
- 1
- 7
10
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 =…
![](../../users/profiles/5027628.webp)
Ankit Raonka
- 4,950
- 8
- 27
- 48
9
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],
…
![](../../users/profiles/2126625.webp)
Paridokht
- 1,237
- 5
- 20
- 41
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…
![](../../users/profiles/4096264.webp)
leo
- 135
- 1
- 1
- 5
9
votes
1 answer
CustomValidator not working well
I have the following piece of asp:
...
![](../../users/profiles/437997.webp)
RanH
- 562
- 1
- 9
- 25
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…
![](../../users/profiles/44637.webp)
nc.
- 6,709
- 5
- 25
- 36
6
votes
1 answer
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…
![](../../users/profiles/6653369.webp)
Carsten Ennulat
- 146
- 1
- 8
6
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…
![](../../users/profiles/3514560.webp)
Abu Sufian
- 137
- 1
- 11
6
votes
1 answer
Register custom ConstraintValidator for existing Constraint
I use bean-validation in my project and I'd like to write a custom validator for an existing constraint annotation.
For example I have a class that represents a date/time named CustomDateTime. In a class that uses this class as for example a date of…
![](../../users/profiles/704616.webp)
siebz0r
- 14,765
- 11
- 55
- 100
5
votes
4 answers
Suppress "base" in error text for custom validation of Rails nested attributes
I have the following models:
class Evaluation < ActiveRecord::Base
attr_accessible :product_id, :description, :evaluation_institutions_attributes
has_many :evaluation_institutions, :dependent => :destroy
accepts_nested_attributes_for…
![](../../users/profiles/623682.webp)
Kevin
- 744
- 1
- 6
- 17