diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-05-30 08:13:34 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:15 -0500 |
commit | 0f7314ea019a42e202346fc429330f1e8dfa9b7d (patch) | |
tree | 2b799a07ac270fb01b23e5c6c47a1c1d8d193d39 /swat/esptest | |
parent | 3f4f393c98e7bc3b2853c699a67a9f5fc2e7d20a (diff) | |
download | samba-0f7314ea019a42e202346fc429330f1e8dfa9b7d.tar.gz samba-0f7314ea019a42e202346fc429330f1e8dfa9b7d.tar.bz2 samba-0f7314ea019a42e202346fc429330f1e8dfa9b7d.zip |
r7093: - added a new Form() ejs object for producing simple forms.
- tidied up the html generation a bit
(This used to be commit ddccf6d2f5c4757111010e3116b41e379a7dc2dd)
Diffstat (limited to 'swat/esptest')
-rw-r--r-- | swat/esptest/exception.esp | 6 | ||||
-rw-r--r-- | swat/esptest/formtest.esp | 36 | ||||
-rw-r--r-- | swat/esptest/session.esp | 13 | ||||
-rw-r--r-- | swat/esptest/showvars.esp | 8 |
4 files changed, 16 insertions, 47 deletions
diff --git a/swat/esptest/exception.esp b/swat/esptest/exception.esp index abea890d98..cfd0f312fa 100644 --- a/swat/esptest/exception.esp +++ b/swat/esptest/exception.esp @@ -5,16 +5,10 @@ <form name="ExceptionTest" method="POST" action="@@request['SCRIPT_NAME']"> <input name="submit" type="submit" value="Generate Exception"> <input name="submit" type="submit" value="No Exception"> - <input name="submit" type="submit" value="Cancel"><br> </form> <% if (request['REQUEST_METHOD'] == "POST") { - /* if they cancelled then take them back to the list of tests */ - if (form['submit'] == "Cancel") { - redirect("/"); - } - function TestFunction(arg1, arg2) { return "OK"; } 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"); %> -<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); } %> diff --git a/swat/esptest/session.esp b/swat/esptest/session.esp index 3d787012c6..ec747df442 100644 --- a/swat/esptest/session.esp +++ b/swat/esptest/session.esp @@ -43,18 +43,7 @@ if (request['REQUEST_METHOD'] == "POST") { } } -function showArray(name, array) { - write("<h3>Array: " + name + "</h3>\n"); - if (array == undefined) { - write("undefined<br>\n"); - return; - } - for (v in array) { - write(name + "[" + v + "]=" + array[v] + "<br>\n"); - } -} - -showArray("session", session); +simple_table(session); write("SessionId=" + request['SESSION_ID'] + "<br>\n"); %> diff --git a/swat/esptest/showvars.esp b/swat/esptest/showvars.esp index 262a0962b7..40008a0d7d 100644 --- a/swat/esptest/showvars.esp +++ b/swat/esptest/showvars.esp @@ -8,9 +8,7 @@ if (array == undefined) { write("undefined<br>\n"); } else { - for (v in array) { - write(name + "[" + v + "]=" + array[v] + "<br>\n"); - } + simple_table(array); } } @@ -23,10 +21,6 @@ showArray("session", session); %> -<form name="Cancel" method="POST" action="/"> - <input name="submit" type="submit" value="Cancel"><br> -</form> - </ul> <% page_footer(); %> |