1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
/***************************************************************
*
* Universal formupdate-function
*
* $Id: jsfunc.updateform.js 196 2004-04-14 09:12:47Z typo3 $
*
*
*
* Copyright notice
*
* (c) 1998-2003 Kasper Skaarhoj
* All rights reserved
*
* This script is part of the TYPO3 t3lib/ library provided by
* Kasper Skaarhoj <kasper@typo3.com> together with TYPO3
*
* Released under GNU/GPL (see license file in tslib/)
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* This copyright notice MUST APPEAR in all copies of this script
***************************************************************/
function updateForm(formname,fieldname,value) {
if (document[formname] && document[formname][fieldname]) {
var fObj = document[formname][fieldname];
var type=fObj.type;
if (!fObj.type) {
type="radio";
}
switch(type) {
case "text":
case "textarea":
case "hidden":
case "password":
fObj.value = value;
break;
case "checkbox":
fObj.checked = ((value && value!=0) ? "on":"");
break;
case "select-one":
var l=fObj.length;
for (a=0;a<l;a++) {
if (fObj.options[a].value == value) {
fObj.selectedIndex = a;
}
}
break;
case "select-multiple":
var l=fObj.length;
for (a=0;a<l;a++) {
if (fObj.options[a].value == value) {
fObj.options[a].selected = 1;
}
}
break;
case "radio":
var l=fObj.length;
for (a=0; a<l;a++) {
if (fObj[a].value==value) {
fObj[a].checked = 1;
}
}
break;
default:
}
}
}
|