Changeset 15254

Show
Ignore:
Timestamp:
02/26/08 13:08:07 (7 months ago)
Author:
flack
Message:

perform sanity checks on date fields, closes #95

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/midcom.helper.datamanager2/formmanager.php

    r15253 r15254  
    247247 
    248248            $this->widgets[$name]->set_form($this->form); 
     249            //Load custom QF rules, so that they can be used in widgets' add_element_to_form calls 
     250            $this->_load_type_qfrules($name); 
    249251            $this->widgets[$name]->add_elements_to_form(); 
    250252            $this->_add_rules_and_filters($name, $config); 
     
    676678    function _add_rules_and_filters($name, $config) 
    677679    { 
    678         $this->_load_type_qfrules($name); 
    679680        $widget =& $this->widgets[$name]; 
    680681        if ($config['readonly']) 
  • trunk/midcom/midcom.helper.datamanager2/widget/jsdate.php

    r15253 r15254  
    175175 
    176176        $this->_form->addGroup($elements, $this->name, $this->_translate($this->_field['title']), '', false); 
     177 
     178        if($this->_field['required']) 
     179        { 
     180            $errmsg = sprintf($this->_l10n->get('field %s is required'), $this->_field['title']); 
     181 
     182            $this->_form->addRule($this->name, $errmsg, 'regex', '/^[^0]/'); 
     183        } 
     184        $this->_form->addRule($this->name, $this->_translate('validation failed: date'), 'checkjsdate'); 
    177185    } 
    178186 
  • trunk/midcom/midcom.helper.datamanager2/widget/simpledate.php

    r15235 r15254  
    110110            $this->_form->addGroupRule($this->name, $errmsg, 'nonzero', null, 3); 
    111111        } 
     112        $this->_form->addRule($this->name, $this->_translate('validation failed: date'), 'checksimpledate'); 
    112113    } 
    113114