home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / Required.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  2.0 KB  |  53 lines

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP version 4.0                                                      |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2003 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors: Bertrand Mansion <bmansion@mamasam.com>                     |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: Required.php,v 1.3 2003/11/03 16:08:24 avb Exp $
  20.  
  21. require_once('HTML/QuickForm/Rule.php');
  22.  
  23. /**
  24. * Required elements validation
  25. * @version     1.0
  26. */
  27. class HTML_QuickForm_Rule_Required extends HTML_QuickForm_Rule
  28. {
  29.     /**
  30.      * Checks if an element is empty
  31.      *
  32.      * @param     string    $value      Value to check
  33.      * @param     mixed     $options    Not used yet
  34.      * @access    public
  35.      * @return    boolean   true if value is not empty
  36.      */
  37.     function validate($value, $options = null)
  38.     {
  39.         if ($value == '') {
  40.             return false;
  41.         }
  42.         return true;
  43.     } // end func validate
  44.  
  45.  
  46.     function getValidationScript($options = null)
  47.     {
  48.         return array('', "{jsVar} == ''");
  49.     } // end func getValidationScript
  50.  
  51. } // end class HTML_QuickForm_Rule_Required
  52. ?>
  53.