Calling setRules multiple times possible? |
Hi,
i want to add an array of additional validation rules to en existing array of rules. $validation->setRules($firstArrayWithRules); $validation->setRules($secondArraywithRules); If i call this in the controller only the second array with rules will be executed and the first rules are ignored. Is there something like addRules, where i can add additional rules to the rules set by setRules method?
(09-06-2022, 06:15 AM)superior Wrote: Like this? Yes, i did it this way but thougt there was an codeigniter native functionality for the validation rules. With a helper function in my controller i collect all rules and pass it to the setRules method. I think if i call the setRules method twice, the first rules are overwritten and set new by the second call
So why don't you build the array first before sending this to the setRules() method?
Logically, the "setX" action should overwrite the previous value. To add to lists it is possible to have "addX"
So create an array before validation P.S. Not really an answer, but a hint |
Welcome Guest, Not a member yet? Register Sign In |