summaryrefslogtreecommitdiff
path: root/static/f/forms.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/f/forms.js')
-rw-r--r--static/f/forms.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/static/f/forms.js b/static/f/forms.js
index ce9daab5..8c3e4e8b 100644
--- a/static/f/forms.js
+++ b/static/f/forms.js
@@ -199,7 +199,7 @@ function relLoad() {
// fetch the relation types from the add new relation selectbox
l = x('relation_new').getElementsByTagName('select')[0].options;
for(i=0;i<l.length;i++)
- relTypes[Math.floor(l[i].value)] = l[i].text;
+ relTypes[l[i].value] = l[i].text;
// read the current relations
l = x('relations').value.split('|||');
@@ -247,7 +247,7 @@ function relAdd(rel, vid, title) {
o.appendChild(t);
var options = '';
- for(var i=0;i<relTypes.length;i++)
+ for(var i in relTypes)
options += '<option value="'+i+'"'+(i == rel ? ' selected="selected"' : '')+'>'+qq(relTypes[i])+'</option>';
t = document.createElement('td');
t.className = 'tc2';
@@ -289,10 +289,11 @@ function relSerialize() {
var l = x('relation_tbl').getElementsByTagName('tr');
for(i=0;i<l.length;i++) {
var title = l[i].getElementsByTagName('td')[0];
+ var rel = l[i].getElementsByTagName('select')[0];
title = title.innerText || title.textContent;
title = title.substr(title.indexOf(':')+1);
r += (r ? '|||' : '')
- +l[i].getElementsByTagName('select')[0].selectedIndex
+ +rel.options[rel.selectedIndex].value
+','+l[i].id.substr(12)+','+title;
}
x('relations').value = r;