Low-Level Fields rules and conditions
- alnux
- Member | 139
Hello, I would like to know how to add validations and rules to low-level
fields.
for example requesting that a field is required (rules) or adding conditions
on documentations
only show how to sanitize them
i will apreciate your help
- dakur
- Member | 493
You can't do it for fields, but you can do it for the form if at least submit button is forms-generated.
$form = new Form();
$form->addSubmit('submit');
$form->onSuccess[] = function () {
$data = $form->getHttpData($form::DataText, 'sel[]');
if (...) { // validation
$form->addError('...');
return;
}
// handle if ok
};
Last edited by dakur (2023-10-02 10:18)