Index: t3lib/jsfunc.validateform.js =================================================================== RCS file: /cvsroot/typo3/TYPO3core/t3lib/jsfunc.validateform.js,v retrieving revision 1.4 diff -u -r1.4 jsfunc.validateform.js --- t3lib/jsfunc.validateform.js 19 Apr 2004 15:25:53 -0000 1.4 +++ t3lib/jsfunc.validateform.js 11 Aug 2005 15:46:13 -0000 @@ -25,7 +25,11 @@ function validateForm(theFormname,theFieldlist,goodMess,badMess,emailMess) { - if (document[theFormname] && theFieldlist) { + var formname = document[theFormname]; + if (!formname) { + formname = document.getElementById(theFormname); + } + if (formname && theFieldlist) { var index=1; var theField = split(theFieldlist, ",", index); var msg=""; @@ -58,8 +62,8 @@ index++; theLabel = unescape(split(theFieldlist, ",", index)); theField = unescape(theField); - if (document[theFormname][theField]) { - var fObj = document[theFormname][theField]; + if (formname[theField]) { + var fObj = formname[theField]; var type=fObj.type; if (!fObj.type) { type="radio"; Index: typo3/sysext/cms/tslib/class.tslib_content.php =================================================================== RCS file: /cvsroot/typo3/TYPO3core/typo3/sysext/cms/tslib/class.tslib_content.php,v retrieving revision 1.78 diff -u -r1.78 class.tslib_content.php --- typo3/sysext/cms/tslib/class.tslib_content.php 14 Jul 2005 12:41:45 -0000 1.78 +++ typo3/sysext/cms/tslib/class.tslib_content.php 11 Aug 2005 15:46:14 -0000 @@ -1572,12 +1572,25 @@ $fieldname_hashArray = Array(); $cc = 0; + $xhtmlStrict = t3lib_div::inList('xhtml_strict,xhtml_11,xhtml_2',$GLOBALS['TSFE']->config['config']['doctype']); // Formname; - $formname = $GLOBALS['TSFE']->uniqueHash(); + $formname = $this->cleanFormName($conf['formName']); + if (!$formname) { + $formname = $GLOBALS['TSFE']->uniqueHash(); + } if (ctype_digit($formname{0})) { // form name must start with a letter $formname = 'a'.$formname; } + $prefix = $formname.'_'; + if(isset($conf['fieldPrefix'])) { + if ($conf['fieldPrefix'] == '0') { + $prefix = ''; + } else { + $prefix = $this->cleanFormName($conf['fieldPrefix']); + } + } + foreach($dataArr as $val) { $cc++; @@ -1602,7 +1615,7 @@ $typeParts = explode('=',$fParts[0]); $confData['type'] = trim(strtolower(end($typeParts))); if (count($typeParts)==1) { - $confData['fieldname'] = substr(ereg_replace('[^a-zA-Z0-9_]','',str_replace(' ','_',trim($parts[0]))),0,30); + $confData['fieldname'] = $this->cleanFormName($parts[0]); if (strtolower(ereg_replace('[^[:alnum:]]','',$confData['fieldname']))=='email') {$confData['fieldname']='email';} // Duplicate fieldnames resolved if (isset($fieldname_hashArray[md5($confData['fieldname'])])) { @@ -1635,9 +1648,15 @@ if (strcmp('',$addParams)) $addParams=' '.$addParams; } else $addParams=''; + if ($conf['dontMd5FieldNames']) { + $fName = $confData['fieldname']; + } else { + $fName = md5($confData['fieldname']); + } + // Accessibility: Set id = fieldname attribute: - if ($conf['accessibility']) { - $elementIdAttribute = ' id="'.$formname.'_'.md5($confData['fieldname']).'"'; + if ($conf['accessibility'] || $xhtmlStrict) { + $elementIdAttribute = ' id="'.$prefix.$fName.'"'; } else { $elementIdAttribute = ''; } @@ -1732,6 +1751,9 @@ break; case 'radio': $option=''; + if ($conf['accessibility'] || $xhtmlStrict) { + $option.=''; + } $valueParts = explode(',',$parts[2]); $items=array(); // Where the items will be $default=''; @@ -1751,10 +1773,23 @@ $default = $this->getFieldDefaultValue($conf['noValueInsert'], $confData['fieldname'], $default); // Create the select-box: for($a=0;$a'; - $option.= $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']); + $radioId = $prefix.$fName.$this->cleanFormName($items[$a][0]); + if ($conf['accessibility']) { + $radioLabelIdAttribute = ' id="'.$radioId.'"'; + } else { + $radioLabelIdAttribute = ''; + } + $option.= ''; + if ($conf['accessibility']) { + $option.= ''; + } else { + $option.= $this->stdWrap(trim($items[$a][0]), $conf['radioWrap.']); + } $option.= '
'; } + if ($conf['accessibility'] || $xhtmlStrict) { + $option.=''; + } $fieldCode = $option; break; case 'hidden': @@ -1836,8 +1871,8 @@ // Field: $fieldLabel = $confData['label']; - if ($conf['accessibility']) { - $fieldLabel = ''; + if ($conf['accessibility'] && $confData['type'] != 'label') { + $fieldLabel = ''; } // Getting template code: @@ -1954,7 +1989,7 @@ $content = Array( '