comparison forms.js @ 58:b98e545a94f7 default tip

Always use children instead of tags. Might break something.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 13 Sep 2011 00:54:55 +0200
parents addbf6bbfaa8
children
comparison
equal deleted inserted replaced
57:addbf6bbfaa8 58:b98e545a94f7
112 if (instructions) 112 if (instructions)
113 form.instructions = instructions; 113 form.instructions = instructions;
114 } 114 }
115 115
116 form.fields = {}; 116 form.fields = {};
117 for (var i in x.tags) { 117 for (var i in x.children) {
118 var field = x.tags[i]; 118 var field = x.children[i];
119 var name = field.getAttribute('var'); 119 var name = field.getAttribute('var');
120 if (params && name == 'FORM_TYPE') 120 if (params && name == 'FORM_TYPE')
121 continue; 121 continue;
122 122
123 if (params) { 123 if (params) {
124 var type = field.getAttribute('type'); 124 var type = field.getAttribute('type');
125 if (type == 'jid-multi' || type == 'list-multi' || type == 'text-multi') { 125 if (type == 'jid-multi' || type == 'list-multi' || type == 'text-multi') {
126 form.fields[name] = []; 126 form.fields[name] = [];
127 for (var j in field.tags) { 127 for (var j in field.children) {
128 var elem = field.tags[j]; 128 var elem = field.children[j];
129 if (elem.name == 'value') 129 if (elem.name == 'value')
130 form.fields[name].push(elem.getText()); 130 form.fields[name].push(elem.getText());
131 } 131 }
132 } else if (type == 'boolean') { 132 } else if (type == 'boolean') {
133 var value = field.getChild('value'); 133 var value = field.getChild('value');
150 form.fields[name].type = type; 150 form.fields[name].type = type;
151 151
152 if (type == 'jid-multi' || type == 'list-multi' || type == 'text-multi') { 152 if (type == 'jid-multi' || type == 'list-multi' || type == 'text-multi') {
153 form.fields[name].options = {}; 153 form.fields[name].options = {};
154 form.fields[name].values = []; 154 form.fields[name].values = [];
155 for (var j in field.tags) { 155 for (var j in field.children) {
156 var elem = field.tags[j]; 156 var elem = field.children[j];
157 if (elem.name == 'option') { 157 if (elem.name == 'option') {
158 var value = elem.getChild('value'); 158 var value = elem.getChild('value');
159 if (!value) 159 if (!value)
160 continue; 160 continue;
161 161