0 レビュー
0 回答
php-ZendFramework2フォームコレクションバリデーター
フォームコレクションを検証して、少なくともN個の要素が含まれていることを確認することはできますか?
フォームにコレクションを追加するには、次の表記法を使用します。
$this->add(array(
'type' => 'Zend\Form\Element\Collection',
'name' => 'categories',
'options' => array(
'label' => 'Please choose categories for this product',
'count' => 2,
'should_create_template' => true,
'allow_add' => true,
'allow_remove' => true,
'target_element' => array(
'type' => 'Application\Form\CategoryFieldset',
),
),
));
要素の最小数が2に設定されていることがわかりますが、それでも1つの要素だけでフォームを保存できます。
わからない
同様の質問
私たちのウェブサイトで同様の質問で答えを見つけてください。