Now I want...">

Check Kohana3 by fields with []

I have a form containing checkboxes.

<input type="checkbox" name="question[5][13]" value="1" />

Now I want to use the Kohana validation class, but it seems that it does not validate fields that are an array ... has anyone ever worked on something?

I have something like this, but this will not work:

$rules->rule('question[5][13]', 'not_empty');
+3
source share
2 answers

There is no need to do it if you have an array, than you should check its values, and not just one value, right?

So, if you have a “question” key in your values ​​that need to be checked, you probably should call back with a custom check for it, right?

so..

$validation_object->callback('question', 'validate_question_method');

... , , , - .

+2

Kohana 3 (3.0.7) . , , .

, , , .

Formo 2 ​​, , .

0

Source: https://habr.com/ru/post/1762515/


All Articles