diff forms.js @ 57:addbf6bbfaa8

Various fixes for the migration to ltx.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Mon, 12 Sep 2011 23:45:00 +0200
parents 99bd1d1ac071
children b98e545a94f7
line wrap: on
line diff
--- a/forms.js
+++ b/forms.js
@@ -62,7 +62,9 @@ exports.build = function(type, desc, con
 			if (desc[i].label)
 				fieldAttr.label = desc[i].label;
 		}
-		x.c('field', fieldAttr);
+
+		var field = new Element('field', fieldAttr);
+		x.cnode(field);
 
 		if (labels &&
 		    (desc[i].type == 'list-multi' ||
@@ -71,22 +73,22 @@ exports.build = function(type, desc, con
 				var optAttr = {};
 				if (desc[i].options[j].label)
 					optAttr.label = desc[i].options[j].label;
-				x.c('option', optAttr).c('value').t(j).up().up();
+				field.c('option', optAttr).c('value').t(j).up().up();
 			}
 		}
 
 		if (i == 'FORM_TYPE')
-			x.c('value').t(desc[i].value).up();
+			field.c('value').t(desc[i].value).up();
 		else if (typeof content[i] != 'undefined') {
 			var md = content[i];
 			if (desc[i].type == 'jid-multi' ||
 			    desc[i].type == 'list-multi' ||
 			    desc[i].type == 'text-multi') {
 				for (var j=0; j<md.length; j++)
-					x.c('value')
+					field.c('value')
 						.t(md[j].toString()).up();
 			} else
-				x.c('value').t(md.toString()).up();
+				field.c('value').t(md.toString()).up();
 		}
 
 		x.up();