CodeIgniter 2.0 - checking arrays

I'm having trouble converting form validation code to CI 2.0. I am trying to check an array of flags, but for some reason the check does not allow a callback or does not check.

How can I check an array of flags so that at least one is checked, and the values ​​must be one of the parameters (option array key)?

EDIT:

Here is the best explanation of where he puts up with me. Suppose I have these fields:

<input type="checkbox" value="1" name="purpose[]" />
<input type="checkbox" value="2" name="purpose[]" />

I set two rules for the purpose [] - one mandatory rule, the other - a custom callback that checks that this value is present in an array of possible values.

If I edit the field name:

<input type="checkbox" value="1" name="purpose[abc]" />

or even change the value to "", the check passes. It ignores the required rule and my custom callback.

- , ?

+3
1
+10

All Articles