/** * This file is part of the TYPO3 CMS project. * * It is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, either version 2 * of the License, or any later version. * * For the full copyright and license information, please read the * LICENSE.txt file that was distributed with this source code. * * The TYPO3 project - inspiring people to share! */ function validateForm(theFormname,theFieldlist,goodMess,badMess,emailMess) { var formObject = document[theFormname]; if (!formObject) { formObject = document.getElementById(theFormname); } if (formObject && theFieldlist) { var index=1; var theField = split(theFieldlist, ",", index); var msg=""; var theEreg = ''; var theEregMsg = ''; var specialMode = ''; var theLabel, a; while (theField) { theEreg = ''; specialMode = ''; // Check special modes: if (theField == '_EREG') { // EREG mode: _EREG,[error msg],[JS ereg],[fieldname],[field Label] specialMode = theField; index++; theEregMsg = split(theFieldlist, ",", index); index++; theEreg = split(theFieldlist, ",", index); } else if (theField == '_EMAIL') { specialMode = theField; } // Get real field name if special mode has been set: if (specialMode) { index++; theField = split(theFieldlist, ",", index); } index++; theLabel = split(theFieldlist, ",", index); theField = theField; if (formObject[theField]) { var fObj = formObject[theField]; var type=fObj.type; if (!fObj.type) { type="radio"; } var value=""; switch(type) { case "text": case "textarea": case "password": case "file": value = fObj.value; break; case "select-one": if (fObj.selectedIndex>=0) { value = fObj.options[fObj.selectedIndex].value; } break; case "select-multiple": var l=fObj.length; for (a=0;a