summaryrefslogtreecommitdiff
path: root/swat/esptest/formtest.esp
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-05-30 08:13:34 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:15 -0500
commitddccf6d2f5c4757111010e3116b41e379a7dc2dd (patch)
tree19ab99e91085ae5098792bed6521279440b050e3 /swat/esptest/formtest.esp
parent5f91db4d60a5b5b03b1b14d1348f9db6807ab18b (diff)
downloadsamba-ddccf6d2f5c4757111010e3116b41e379a7dc2dd.tar.gz
r7093: - added a new Form() ejs object for producing simple forms.
- tidied up the html generation a bit
Diffstat (limited to 'swat/esptest/formtest.esp')
-rw-r--r--swat/esptest/formtest.esp36
1 files changed, 14 insertions, 22 deletions
diff --git a/swat/esptest/formtest.esp b/swat/esptest/formtest.esp
index 89e542c5529..2d3693355cc 100644
--- a/swat/esptest/formtest.esp
+++ b/swat/esptest/formtest.esp
@@ -1,34 +1,26 @@
<% page_header("columns", "ESP Form Test"); %>
-<form name="FormTest" method="POST" action="@@request['SCRIPT_NAME']">
- firstName: <input name="firstName" type="text" value=""><br>
- lastName: <input name="lastName" type="text" value=""><br>
- <input name="submit" type="submit" value="OK">
- <input name="submit" type="submit" value="Cancel"><br>
-</form>
+<%
+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']<p>
+
<%
-
- function showArray(name, array) {
- write("<h3>Array: " + name + "</h3>\n");
- for (v in array) {
- write(name + "[" + v + "]=" + array[v] + "<br>\n");
- }
- }
-
- showArray("form", form);
+ simple_table(form);
}
%>