From 0f7314ea019a42e202346fc429330f1e8dfa9b7d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 30 May 2005 08:13:34 +0000 Subject: r7093: - added a new Form() ejs object for producing simple forms. - tidied up the html generation a bit (This used to be commit ddccf6d2f5c4757111010e3116b41e379a7dc2dd) --- swat/esptest/formtest.esp | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) (limited to 'swat/esptest/formtest.esp') diff --git a/swat/esptest/formtest.esp b/swat/esptest/formtest.esp index 89e542c552..2d3693355c 100644 --- a/swat/esptest/formtest.esp +++ b/swat/esptest/formtest.esp @@ -1,34 +1,26 @@ <% page_header("columns", "ESP Form Test"); %> -
- firstName:
- lastName:
- -
-
+<% +var f = Form("FormTest", 2, 2); +f.element[0].label = "First Name"; +f.element[0].name = "firstName"; +f.element[1].label = "Last Name"; +f.element[1].name = "lastName"; +f.submit[0] = "OK"; +f.submit[1] = "Cancel"; + +display_form(f); <% /* if its a post then the user has filled in the form, so report the values */ - if (request['REQUEST_METHOD'] == "POST") { - - /* if they cancelled then take them back to the list of tests */ - if (form['submit'] == "Cancel") { - redirect("/"); - } + if (form['OK']) { %> - You chose firstName=@@form['firstName'] lastName=@@form['lastName'] + You chose firstName=@@form['firstName'] lastName=@@form['lastName']

+ <% - - function showArray(name, array) { - write("

Array: " + name + "

\n"); - for (v in array) { - write(name + "[" + v + "]=" + array[v] + "
\n"); - } - } - - showArray("form", form); + simple_table(form); } %> -- cgit