From 83dffb602a2d29d0f0030ba171c722ae254a37ca Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Mon, 23 Aug 2010 00:35:10 +0200 Subject: [PATCH] Add ability to render forms (no submitting yet) --- index.html | 2 +- js/main.js | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 93 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 28ce002..a4ab660 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -XMPP Chat +adHocWeb diff --git a/js/main.js b/js/main.js index 61ddaa4..c20969d 100644 --- a/js/main.js +++ b/js/main.js @@ -42,16 +42,103 @@ function onConnect(status) { } } +function addNote(elem, text, type) { + if (!type) { + type = "info"; + } + $(elem).append("

" + text + "

"); +} + +function addForm(elem, x) { + var form = $("
"); + form.submit(function(){return false;}); + var fieldset = $("
"); + form.append(fieldset); + $("").text($(x).find("title").text()).appendTo(fieldset); + $("

").text($(x).find("instructions").text()).appendTo(fieldset); + $(x).find("field").each(function(){ + var item = null; + var type = $(this).attr("type"); + if($(this).attr("label")) { + $("