Post by Schubaltz on Mar 6, 2008 19:11:50 GMT -5
Try this (it'll work without all the Read First stuff, so you can take that out of your headers/footers if you want)
<script type="text/javascript">
<!--
// Additional Options in Profile
var ops = [
[ "Field Name", "Field Description",
"Option 1", "Option 2", "Option 3", "Option 4", "Option 5" ],
[ "Field Name", "Field Description",
"Option 1", "Option 2", "Option 3", "Option 4", "Option 5" ]
// Repeat the above pattern for more fields
], exn = [], pre = [];
if(location.href.match(/action=((pm)?view|display)/))
for(var l = document.links, k = 4; k < l.length; k ++) if(l[k].className == "nav") {
for(var i = l[k].parentNode.getElementsByTagName("table")[1].rows, x = 1; x < i.length; x ++) {
if(i[x].cells[0].className == "titlebg")
break;
if(i[x].cells[0].className == "catbg" || !i[x].cells[0].getElementsByTagName("b")[0])
continue;
if(i[x].cells[0].innerHTML.match(/##(%?\d+)+##/)) {
pre = i[x].cells[0].innerHTML.split("##")[1];
for(var e = 0; e < pre.split("%").length; e ++) if(pre.split("%")[e] != "0")
exn.push(ops[e][0] + ": " + ops[e][pre.split("%")[e] - -1]);
i[x].cells[0].innerHTML = i[x].cells[0].innerHTML.replace(/##(%?\d+)+##/, "") + exn.join("<br />");
exn = [];
}
}
break;
}
if(document.modifyForm) {
var tables = document.modifyForm.getElementsByTagName("tbody");
tables[1].rows[1].style.display = "none";
for(var x in ops) {
pre[x] = (document.modifyForm.customtitle.value.split("##")[1].split("%")[x] - 1) + 1 || 0;
var row = tables[1].insertBefore(tables[1].rows[0].cloneNode(true), tables[1].rows[4 - -x]);
row.cells[0].firstChild.firstChild.data = ops[x][0] + ":";
row.cells[2].firstChild.firstChild.data = ops[x][1];
var obj = document.createElement("select"); obj.name = x;
obj[0] = new Option("-----");
for(var e = 2; e < ops[x].length; e ++)
obj[e - 1] = new Option(ops[x][e]);
obj.selectedIndex = pre[x];
obj.onchange = new Function("pre[this.name] = this.selectedIndex");
row.cells[1].firstChild.replaceChild(obj, row.cells[1].firstChild.firstChild);
}
document.modifyForm.customtitle.value = document.modifyForm.customtitle.value.replace(/##(%?\d+)+##/, "");
document.modifyForm.onsubmit = new Function("document.modifyForm.customtitle.value += '##' + pre.join('%') + '##'");
}
//-->
</script>
<script type="text/javascript">
<!--
// Additional Options in Profile
var ops = [
[ "Field Name", "Field Description",
"Option 1", "Option 2", "Option 3", "Option 4", "Option 5" ],
[ "Field Name", "Field Description",
"Option 1", "Option 2", "Option 3", "Option 4", "Option 5" ]
// Repeat the above pattern for more fields
], exn = [], pre = [];
if(location.href.match(/action=((pm)?view|display)/))
for(var l = document.links, k = 4; k < l.length; k ++) if(l[k].className == "nav") {
for(var i = l[k].parentNode.getElementsByTagName("table")[1].rows, x = 1; x < i.length; x ++) {
if(i[x].cells[0].className == "titlebg")
break;
if(i[x].cells[0].className == "catbg" || !i[x].cells[0].getElementsByTagName("b")[0])
continue;
if(i[x].cells[0].innerHTML.match(/##(%?\d+)+##/)) {
pre = i[x].cells[0].innerHTML.split("##")[1];
for(var e = 0; e < pre.split("%").length; e ++) if(pre.split("%")[e] != "0")
exn.push(ops[e][0] + ": " + ops[e][pre.split("%")[e] - -1]);
i[x].cells[0].innerHTML = i[x].cells[0].innerHTML.replace(/##(%?\d+)+##/, "") + exn.join("<br />");
exn = [];
}
}
break;
}
if(document.modifyForm) {
var tables = document.modifyForm.getElementsByTagName("tbody");
tables[1].rows[1].style.display = "none";
for(var x in ops) {
pre[x] = (document.modifyForm.customtitle.value.split("##")[1].split("%")[x] - 1) + 1 || 0;
var row = tables[1].insertBefore(tables[1].rows[0].cloneNode(true), tables[1].rows[4 - -x]);
row.cells[0].firstChild.firstChild.data = ops[x][0] + ":";
row.cells[2].firstChild.firstChild.data = ops[x][1];
var obj = document.createElement("select"); obj.name = x;
obj[0] = new Option("-----");
for(var e = 2; e < ops[x].length; e ++)
obj[e - 1] = new Option(ops[x][e]);
obj.selectedIndex = pre[x];
obj.onchange = new Function("pre[this.name] = this.selectedIndex");
row.cells[1].firstChild.replaceChild(obj, row.cells[1].firstChild.firstChild);
}
document.modifyForm.customtitle.value = document.modifyForm.customtitle.value.replace(/##(%?\d+)+##/, "");
document.modifyForm.onsubmit = new Function("document.modifyForm.customtitle.value += '##' + pre.join('%') + '##'");
}
//-->
</script>