Ignore:
Timestamp:
Jun 22, 2006 9:27:31 PM (18 years ago)
Author:
scdev
Message:

Q - update FormValidator? so err() prints a different class type depending on error type.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FormValidator.inc.php

    r166 r178  
    4343    var $errors = array();
    4444   
    45     // Default error marker.
    46     var $marker = ' sc-msg-error ';
    47 
    4845    /**
    4946     * Return the current list of errors.
     
    9289            foreach ($this->errors as $err) {
    9390                if ($err['name'] == $form_name) {
    94                     return true;
     91                    return $err['type'];
    9592                }
    9693            }
     
    160157    function err($form_name, $marker=null)
    161158    {
    162         if ($this->anyErrors($form_name)) {
     159        if (false !== ($type = $this->anyErrors($form_name))) {
    163160            if (isset($marker)) {
    164161                echo $marker;
    165162            } else {
    166                 echo $this->marker;
     163                switch ($type) {
     164                case MSG_ERR:
     165                default:
     166                    echo ' sc-msg-error ';
     167                    break;
     168
     169                case MSG_WARNING:
     170                    echo ' sc-msg-warning ';
     171                    break;
     172
     173                case MSG_SUCCESS:
     174                    echo ' sc-msg-success ';
     175                    break;
     176
     177                case MSG_NOTICE:
     178                    echo ' sc-msg-notice ';
     179                    break;
     180                }
    167181            }
    168182        }
Note: See TracChangeset for help on using the changeset viewer.