Welcome to the Cookbook

loading...

4.1.4.19 inList

This rule will ensure that the value is in a given set. It needs an array of values. The field is valid if the field's value matches one of the values in the given array.

Example:
	var $validate = array(
	  'function' => array(
	  	'allowedChoice' => array(
	  		'rule' => array('inList', array('Foo', 'Bar')),
	  		'message' => 'Enter either Foo or Bar.'
	  	)
	  )
	);
  1. var $validate = array(
  2. 'function' => array(
  3. 'allowedChoice' => array(
  4. 'rule' => array('inList', array('Foo', 'Bar')),
  5. 'message' => 'Enter either Foo or Bar.'
  6. )
  7. )
  8. );