Usage Changes of Validation Callback #441
Replies: 1 comment
-
Or use shortest method: ...
$this->form_validation->setRule('field_name', 'Field Label', ['required', [$this, 'function_name']]);
...
...
public function function_name($value)
{
if ($value !== 1) {
$this->form_validation->setError('field', 'The field label must be equal to 1');
}
return true;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When you using a native form validation without Aksara renderer, you may need a custom validation callback. Since the validation callback has changed, you couldn't using string validation (usually using
callback_
prefix) anymore to call your own validation function.Instead, below is a working sample of replacement:
You can still use multiple rules and the rules must be typed as array when you using the callback validation.
Beta Was this translation helpful? Give feedback.
All reactions