Fix failure to load the schema on read-only DB.
[gd/samba/.git] / swat / esptest / formtest.esp
index 7996900eb210bd53c6754e4256dc499c4abc17a6..23108498954b0f03ff46a866ad1290d3925f5374 100644 (file)
@@ -1,41 +1,35 @@
-<HTML>
-<TITLE>
-Samba4 ESP test
-</TITLE>
-<BODY>
-<h1>Samba4 form test</h1>
+<% page_header("columns", "ESP Form Test", "esptest"); 
+   include("/scripting/forms.js");
+%>
+
+<%
+var f = FormObj("FormTest", 3, 2);
+f.element[0].label = "First Name";
+f.element[0].name  = "firstName";
+f.element[0].value = form['firstName'];
+f.element[1].label = "Last Name";
+f.element[1].name  = "lastName";
+f.element[1].value = form['lastName'];
+f.element[2].label = "Color";
+f.element[2].type  = "select";
+f.element[2].list  = new Array("Red", "Green", "Blue", "Yellow");
+f.element[2].value = form['Color'];
+f.submit[0] = "OK";
+f.submit[1] = "Cancel";
 
-<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>
+f.display();
 
 <%
   /* 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("index.esp");
-  }
+  if (form['submit'] == "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);
   }
 %>
 
-</BODY>
-</HTML>
+<% page_footer(); %>