Tag: validation
-
Custom Error Message for PriceInCents – Vue3 and Vuelidate
Hey everyone, This is a quick post to show how you can add a custom error message when using Vuelidate in Vue3. In my case I have a price field that should not be greater than $1000. The issue is that I store the amount in cents which results in the following error: This is…
-
OpenXml Validation Spreadsheet Value Between Two Numbers – C#
Hi everyone, Just a quick post on how to validate a numeric cell to ensure that the value is between two numbers when using OpenXml: // Restrict min and max values var dataValidations = new DocumentFormat.OpenXml.Spreadsheet.DataValidations { Count = 0 }; DocumentFormat.OpenXml.Spreadsheet.DataValidation dataValidation; dataValidation = new DocumentFormat.OpenXml.Spreadsheet.DataValidation { Type = DataValidationValues.Decimal, AllowBlank = false, SequenceOfReferences…
-
Change Default MVC5 Password Complexity Requirements – Passwords must have at least one non letter or digit character. Passwords must have at least one digit (‘0’-‘9’). Passwords must have at least one uppercase (‘A’-‘Z’)
Hey everyone, I’ve started on a new MVC5 project and came across the following error message while trying to register a new user: Passwords must have at least one non letter or digit character. Passwords must have at least one digit (‘0’-‘9’). Passwords must have at least one uppercase (‘A’-‘Z’) While having a secure password…
-
Detecting FileSize – jQuery
Hey everyone, Just a quick post on how to detect a file’s size with jQuery. I’m currently using a version of this for basic client side validation: Upload image: $(document).ready(function(){ $(‘#image-file’).bind(‘change’, function() { var fileSize = this.files && this.files.length > 0 && this.files[0].size ? this.files[0].size / 1024 / 1024 : 0; if(fileSize > 0){ $(‘body’).append(”…
-
preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash – CakePHP
Hey everyone, Ran into the following error while I was mucking around with CakePHP today: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash The error seemed a little weird as I wasn’t using any regex. It turned out that it was because of my custom validation methods. I had marked them as private instead…
-
Validating Boolean Value of False in Rails
I came across a bit of a weird one this afternoon when trying to validate. Several of my fields appeared to be incorrectly flagged as not having a value. This is the validation I was using: #Define validation validates :order_id, :user_id, :acknowledged, :completed, :presence => true The fields that were flagging as not present…
-
Validation Error Messages not Displaying – Ruby on Rails
Just another quick problem I ran into, the validation was indicating that an error had occurred however it did not show what the error was: 1 error prohibited this message from being saved: — Usually an error would appear here — Turns out the problem was pretty straight forward – it’s always the little things!…