RuleSelectOrText
From FVue
<?php require_once('HTML/QuickForm/Rule.php'); /** * Required elements validation * @version 1.0 */ class HTML_QuickForm_Rule_SelectOrText extends HTML_QuickForm_Rule { /** * Checks if a group element contains either a selection or text * * @param string $value Value to check. Contains: * * Array( * [select_name] => <number> * [text_name] => <string> * ) * * @param mixed $options Not used yet * @access public * @return boolean true if value is not empty */ function validate($value, $options = null) { $result = false; $i = 0; foreach ($value as $el_name => $el_value) { if ((0 == $i) && (0 !== $el_value)) { $result = true; break; } if ((1 == $i) && ('' !== $el_value)) { $result = true; break; } $i++; } // foreach return $result; } // end func validate function getValidationScript($options = null) { return array('', "false"); } // end func getValidationScript } // end class HTML_QuickForm_Rule_SelectOrText
Advertisement