custom-validators

How do I hook up javascript to my CustomValidator control in .Net

大城市里の小女人 提交于 2019-12-02 08:46:00
I have created a CustomValidator control public class MyValidator :CustomValidator, IScriptControl {} and also created the equivalent client script. The server validation works fine, however how do I hook up my client script? The rendered javascript looks like var MyValidator1 = document.all ? document.all["MyValidator1"] : document.getElementById("MyValidator1"); MyValidator1.controltovalidate = "MyField"; MyValidator1.errormessage = "error"; MyValidator1.evaluationfunction = "MyValidatorEvaluateIsValid"; How do I override the generated javascript to set the value of evaluationfunction? E.g.

Custom Validation Not Working- Yii2-app-basic-Yii2

扶醉桌前 提交于 2019-12-01 21:52:41
问题 I Posted one question yesterday regarding custom validation for radio button Textfield Mandatory On Radio Button. I got answer. But, that was not exact answer. But, it solved one problem of mine. Actually, I've 2 radio button. Individual Firm When, Radio Button having "Individual" value is selected, CompanyName textbox should not be mandatory. But, when Radio Button having "Firm" value is selected, CompanyName textbox should be mandatory. Now what happening is, When i select radio button

Grails: Custom validator based on a previous value of the field

耗尽温柔 提交于 2019-12-01 21:18:13
I am trying to create a custom validator for variable 'amount' in my domain class, such that the new value should be greater than previous by 0.50. For example, lets say the previous value was 1.0, next time the value should be atleast: [previous value + 0.50] or more. Thanks in advance for the help You can try reading domainEntity.getPersistentValue('amount') . EDIT: ... in custom validator, like: class Bid { Double amount ... static constraints = { amount(validator: { double a, Bid b -> def oldValue = b.getPersistentValue('amount') a > oldValue + 0.5 ? true : "Amount $a should be at least $

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

倖福魔咒の 提交于 2019-11-28 15:48:16
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 items. protected $rules = [ 'shipping_country' => ['max:60'], 'items' => ['array|numericarray'] ]; My cusotom function is given below Validator::extend('numericarray', function($attribute, $value, $parameters) { foreach ($value as $v) { if (!is_int($v)) { return false; } } return true; }); How can use this validation method with about form request

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

故事扮演 提交于 2019-11-28 03:18:36
问题 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 input. Object structure is: {foo: function($el) { return true || false } } Adding the validator to an input is done just like the others, data-foo="bar" . You must also add default error messages for any custom validators via the errors option. I don't