validation

Cannot get validation working with Spring Boot and Thymeleaf

百般思念 提交于 2021-02-17 09:22:21
问题 I have a Spring Boot application (using version 1.2.3) with 1 controller that shows a form. This all works fine, but now I want to add validation. I have this method in my controller: @RequestMapping(value = "/licensing", method = RequestMethod.POST) public String doRegistration( @Valid CustomerLicenseRegistration customerLicenseRegistration, Model model, BindingResult bindingResult ) { if( bindingResult.hasErrors()) { logger.debug( "There are errors! {}", bindingResult ); return "customer

Codeigniter using form validation function “matches” with sub-array POST

喜夏-厌秋 提交于 2021-02-17 03:19:30
问题 Just started with CI last week and got this issue. What to put inside the matches function if I'm passing the form data as an array? I use array in the html form to locate all input fields inside single array in case I want to pass user generated input such as multiple phone numbers or emails. So everything is placed in array such as this: <div> <label for="password">Password</label> <input type="password" name="input[password]" id="password" value="<?php echo set_value("input[password]")?>"/

Joi Validation Regex or pattern

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-16 20:23:49
问题 I want to joi use regex pattern which define in variable I have a variable pattern which contains regex i.e pattern = "/^[0-9+]{7}-[0-9+]{1}$/" and this pattern send to Joi module and want to confirm module.exports = { save: { body: { match: Joi.string().regex(pattern).required } } } I know validation work if I use this module.exports = { save: { body: { match: Joi.string().regex(/^[0-9+]{7}-[0-9+]{1}$/).required } } } But in my case every time regex will different. So I can not use above

Domain validation using the notification pattern

十年热恋 提交于 2021-02-16 13:57:26
问题 Historically I have performed validation of my objects within their constructors and thrown an exception when validation fails. For example: class Name { const MIN_LENGTH = 1; const MAX_LENGTH = 120; private $value; public function __construct(string $name) { if (!$this->isValidNameLength($name)) { throw new InvalidArgumentException( sprintf('The name must be between %d and %d characters long', self::MIN_LENGTH, self::MAX_LENGTH) ); } $this->value = $name; } public function changeName(string

Domain validation using the notification pattern

荒凉一梦 提交于 2021-02-16 13:57:06
问题 Historically I have performed validation of my objects within their constructors and thrown an exception when validation fails. For example: class Name { const MIN_LENGTH = 1; const MAX_LENGTH = 120; private $value; public function __construct(string $name) { if (!$this->isValidNameLength($name)) { throw new InvalidArgumentException( sprintf('The name must be between %d and %d characters long', self::MIN_LENGTH, self::MAX_LENGTH) ); } $this->value = $name; } public function changeName(string

how to validate string input field for pattern on JSF form

Deadly 提交于 2021-02-16 13:54:49
问题 i have a requirement where a input field which takes strings can have only one of these formats, what is the best way to implement this using javascript or jsf validator: N/A-N-N-N or N/A-N-N-N-N There can be any alphabet in pattern above in place of A. there can be any numeric in pattern above in place of N other than 0. 回答1: First of all, there is no "best" way. There's just the "right" way which depends on the concrete functional requirements. The normal approach to validate in JSF is to

how to validate string input field for pattern on JSF form

℡╲_俬逩灬. 提交于 2021-02-16 13:54:01
问题 i have a requirement where a input field which takes strings can have only one of these formats, what is the best way to implement this using javascript or jsf validator: N/A-N-N-N or N/A-N-N-N-N There can be any alphabet in pattern above in place of A. there can be any numeric in pattern above in place of N other than 0. 回答1: First of all, there is no "best" way. There's just the "right" way which depends on the concrete functional requirements. The normal approach to validate in JSF is to

C# Set Data Annotation on List<string> [duplicate]

不打扰是莪最后的温柔 提交于 2021-02-16 13:34:26
问题 This question already has answers here : Required Attribute on Generic List Property (4 answers) Closed 7 years ago . I have this piece of code: [Required] public List<string> myStringList { get; set; } Unfortunatelly, it doesn't work, tha validator totally ignores it. Besides, this works fine: [Required] public string myString { get; set; } and DateTimes work fine as well. Obviously, the problem doesn't lie on my validator, but on the annotation. So the question is, how should I set the Data

C# Set Data Annotation on List<string> [duplicate]

那年仲夏 提交于 2021-02-16 13:34:01
问题 This question already has answers here : Required Attribute on Generic List Property (4 answers) Closed 7 years ago . I have this piece of code: [Required] public List<string> myStringList { get; set; } Unfortunatelly, it doesn't work, tha validator totally ignores it. Besides, this works fine: [Required] public string myString { get; set; } and DateTimes work fine as well. Obviously, the problem doesn't lie on my validator, but on the annotation. So the question is, how should I set the Data

Email validation Javascript+RegEx, but to exclude certain domains

梦想的初衷 提交于 2021-02-15 07:52:21
问题 I have client side email validation script Javascript+RegEx, it works fine, but I want to exclude certain domains while validating, namely all Apple domains since they do not work (emails sent to these addresses are deleted without any notice): @apple.com, @me.com, @icloud.com, @mac.com. I found appropriate questions here, but still they are not the same I am asking for help. Please, help to implement this Can it be done via RegEx modification, or I have to use loop and search substrings (