Exemple #1
0
	/**
	 * Count/length validator.
	 * @param  NMultiSelectBox
	 * @param  array  min and max length pair
	 * @return bool
	 */
	public static function validateLength(NMultiSelectBox $control, $range)
	{
		if (!is_array($range)) {
			$range = array($range, $range);
		}
		$count = count($control->getSelectedItem());
		return ($range[0] === NULL || $count >= $range[0]) && ($range[1] === NULL || $count <= $range[1]);
	}
 public function __construct($label = NULL, array $items = NULL, $size = NULL, $all_items = NULL)
 {
     parent::__construct($label, $items, $size);
     $this->control->class = 'multiselect';
 }