public static function getElement($name = '', $widgetId = '')
    {
        $eltClass = null;
        
        $definition = WidgetRegistry::getWidgetDefinitionById($widgetId);
        if (is_null($definition) || !isset($definition['renderers'][self::$renderMode])) {
            
            // could be a "pseudo" widget that has not been registered
            $candidate = "tao_helpers_form_elements_xhtml_{$widgetId}";
            if (class_exists($candidate)) {
                $eltClass = $candidate;
            }
        } else {
            $eltClass = $definition['renderers'][self::$renderMode];
        }
        
        if (!is_null($eltClass)) {
            $returnValue = new $eltClass($name);
            if(!$returnValue instanceof tao_helpers_form_FormElement){
                throw new common_Exception("$eltClass must be a tao_helpers_form_FormElement");
            }
        } else {
            $returnValue = null;
            common_Logger::w("Widget type with id ".$widgetId." not yet supported", array('FORM'));
        }
                
        return $returnValue;
    }