MultipleRequired.php 896 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Required elements validation
  5. * @version 1.0
  6. */
  7. class HTML_QuickForm_Rule_MultipleRequired extends HTML_QuickForm_Rule
  8. {
  9. /**
  10. * Checks if all the elements are empty
  11. *
  12. * @param string $value Value to check (can be an array)
  13. * @param mixed $options Not used yet
  14. * @access public
  15. * @return boolean true if value is not empty
  16. */
  17. function validate($value, $options = null)
  18. {
  19. if(is_array($value))
  20. {
  21. $value = implode(null,$value);
  22. }
  23. if ((string)$value == '') {
  24. return false;
  25. }
  26. return true;
  27. } // end func validate
  28. function getValidationScript($options = null)
  29. {
  30. return array('', "{jsVar} == ''");
  31. } // end func getValidationScript
  32. } // end class HTML_QuickForm_Rule_MultipleRequired