Topic: Custom validation
How can I write custom validation function?
(I need something like date validation)
Can I place it in the different place than validation.php in core?
rapyd forum
You are not logged in. Please login or register.
How can I write custom validation function?
(I need something like date validation)
Can I place it in the different place than validation.php in core?
answer is:
- you can use a standard php "function" or custom defined "function".
(the function must get an input and return a modified output, or a boolean in this case "false" means not-valid.)
- you can use "callback" (to a controller method)
- you can also use a string "mask"
samples here
http://test.rapyd.com/form/index
'trim' is a standard php function used to strip spaces from field value,
'callback_customcheck' means check this field using 'customcheck' method of this controller
'->mask('aaaaaa99a99a999a')' means if user doesn't fill the field with this pattern (6chars,2digits,1char,2digits...) cleanup it
however good point, how extend validation to preserve core validation class and make custom validation functions set? (not possible @ this moment)