Jump to content

Add minItems to Stack field


Adriano Faria

Recommended Posts

I'm able to make a validation:

$form->add( new \IPS\Helpers\Form\Stack( 'question_wrong', isset( $question['question_wrong']) ? json_decode( $question['question_wrong'], TRUE ) : array(), TRUE, array( 'maxItems' => $container->max_answers-1 ), function( $val ) use( $container ) {
				if( $val and is_array( $val ) AND count( $val ) < $container->min_answers-1 )
				{
					throw new \InvalidArgumentException( 'quizz_min_number_questions_required' );
				}
			}, NULL, NULL, 'question_wrong' ) );

But I'm also able to make it for max items, so for consistency sake,  minItems would save us time.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...