Hi,
I used the form validation library to validate a form containing arrays.
Code:
<form>
<input type='text' name='date'>
<input type='text' name='invoice_rule[1]'>
<input type='text' name='invoice_rule[2]'>
......
<input type='submit'>
</form>
I had the following validation rule:
PHP Code:
'invoice_rule' => ['rules' => 'numeric', 'errors' => ['numeric' => 'Not numeric']]
This worked fine and walked through all the invoice rules.
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!