/** * Called by HTML_QuickForm whenever form event is made on this element * * @param string Name of event * @param mixed event arguments * @param object calling object * @since 1.0 * @access public * @return bool */ static function onQuickFormEvent($event, $arg, &$caller) { switch ($event) { case 'updateValue': if ($caller->getAttribute('method') == 'get') { return PEAR::raiseError('Cannot add a file upload field to a GET method form'); } self::$_value = self::_findValue(); $caller->updateAttributes(array('enctype' => 'multipart/form-data')); $caller->setMaxFileSize(); break; case 'addElement': self::onQuickFormEvent('createElement', $arg, $caller); return self::onQuickFormEvent('updateValue', null, $caller); break; case 'createElement': $className = get_class($this); self::$className($arg[0], $arg[1], $arg[2]); break; } return true; }