Form validation in 4.1.6 raises type error - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Form validation in 4.1.6 raises type error (/showthread.php?tid=80942) |
Form validation in 4.1.6 raises type error - sjender - 01-05-2022 Hi, I used the form validation library to validate a form containing arrays. Code: <form> PHP Code: 'invoice_rule' => ['rules' => 'numeric', 'errors' => ['numeric' => 'Not numeric']] But now it raises an error "Argument 1 passed to CodeIgniter\Validation\FormatRules::numeric() must be of the type string or null, array given". I looked at the changelog and indeed, this is one of the changes... But how am I supposed to validate each element of the array? I don't want to foreach it, because it makes the code less readable. Never mind.... already found it. Typing this message took me longer than reading the manual. LOL. invoice_rule.* did the trick! RE: Form validation in 4.1.6 raises type error - kenjis - 01-05-2022 Thank you for the feedback! I will add it to Upgrading from 4.1.5 to 4.1.6. RE: Form validation in 4.1.6 raises type error - kenjis - 01-06-2022 Added the instruction: https://codeigniter4.github.io/CodeIgniter4/installation/upgrade_416.html#validation-result-changes |