Input Validation on Array

I am attempting to input validate a user’s value. Criteria: The value inputted cannot be a negative number, in my case the error is encountered when a user enters the wrong value, but instead if reattempting to input the value in the same element it skips over to the next element in the array. string… Read More Input Validation on Array

How to validate class String property is not empty in Kotlin?

Given: class JWTToken(val token: String) { // … var email: String = jwt.claims["email"]?.asString()?: throw Exception("null email") } The exception is thrown if wt.claims["email"] is null, but not if the is string empty. How can the check for the empty string be concisely added? >Solution : Kotlin’s require built-in would be a good candidate here: val… Read More How to validate class String property is not empty in Kotlin?

How to validate jquery validation together

I am working on javascript/jquery and i have following form and i want to validate without "validation engine",So how can i validate all fields together ? I tried with following code async function completeListing(elm) { var type= $("input[name=’selct-type’]:checked").val(); var quantity= $("#number").val(); var price= $("#priice").val(); if(type=="") { $("#radio_error").show(); } if(price=="") { $("#price_error").show(); } if(quantity=="") { $("#quantity_error").show();… Read More How to validate jquery validation together

Regex for comma separated URL

How can I validate the comma separated urls in a way that accepts subdomains, localhost and allows whitespace before or after the comma? Here’s an example of how I’d like this to work: const regEx = regex; // working regular expression here console.log(regEx.test(‘localhost:3000’)); // should return true console.log(regEx.test(‘https://google.com,https://jeith.com’)); // should return true console.log(regEx.test(‘subdomain.jeith.com, localhost:3000’)); //… Read More Regex for comma separated URL

Sheet doesn't recalculate after picking from list including own function

I have workbook with user VBA function (returning name of the cell): Function cellName() cellName = ActiveCell.Offset(0, 0).Name.Name End Function I have a list dictList with 3 columns used as dictionary (cellNames; ENG equivalents; CZ equivalents) I have a cell $P$1 including data validation that can contain EN/CZ value. Each cell in the sheet that… Read More Sheet doesn't recalculate after picking from list including own function

Error when using my own validator (Angular, Reactive-Forms)

This is my piece of code, when I try to use an own validator, to make sure, the name does not contain numbers: ngOnInit() { // HERE this.bewerberForm = new FormGroup({ ‘name’: new FormControl(null, Validators.required, this.containsNumbers), ’email’: new FormControl(null, [Validators.required, Validators.email]), … } containsNumbers(control: FormControl): Promise<any> | Observable<any> { const promise = new Promise<any>((resolve, reject)… Read More Error when using my own validator (Angular, Reactive-Forms)

Laravel validation required_if doesn't work

I want to make a field mandatory if another field contains the "{" character. I’ve tried several combinations but it looks like Laravel doesn’t apply the rule at all. public function rules() { $rules = [ ‘title’ => ‘required’, ‘url’ => ‘required’, ‘model_name’ => ‘required_if:url,url:regex:/{/’, // The following doesn’t work either: // ‘model_name’ => ‘required_if:url,url:not_regex:/{/’,… Read More Laravel validation required_if doesn't work

Can I create custom validation annotation that inherits from javax.constrains annotations

I’m wondering if it’s possible to do something like: @Min(1) @Max(100) public @interface ValidationForX {} and then @ValidationForX int X; For some reason @Min and @Max are applicable on annotations so I’m assuming it should be possible I want to hide this validation behind one annotation because I want to reuse it Thanks for your… Read More Can I create custom validation annotation that inherits from javax.constrains annotations

How to handle something like [1,2,3] with html5 input type text?

I would like to know if we can handle specific input like the following examples using pattern: [1] or [1,2] so basically brackets with a number or if there are more numbers then only comma allowed as a separator. Tried [(\d+(\s*,?))+] as stated below but it doesn’t work. >Solution : This would do it: ^\[\d+(?:,\d+)*\]$… Read More How to handle something like [1,2,3] with html5 input type text?