01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: Multiple.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.engine.testelements.submission;
09:
10: import com.uwyn.rife.engine.Element;
11: import com.uwyn.rife.tools.StringUtils;
12:
13: public class Multiple extends Element {
14: public void processElement() {
15: if (hasSubmission("login")) {
16: print(getParameter("login")
17: + ","
18: + getParameter("password")
19: + ","
20: + StringUtils.join(getParameterValues("language"),
21: "|"));
22: } else if (hasSubmission("register")) {
23: print(getParameter("login") + ","
24: + getParameter("password") + ","
25: + getParameter("firstname") + ","
26: + getParameter("lastname"));
27: } else {
28: print("<html><body>\n");
29: print("<form name=\"login\" action=\""
30: + getSubmissionQueryUrl("login")
31: + "\" method=\"post\">\n");
32: print("<input name=\"login\" type=\"text\">\n");
33: print("<input name=\"password\" type=\"password\">\n");
34: print("<select name=\"language\" multiple=\"1\">\n");
35: print("<option value=\"fr\">french</option>\n");
36: print("<option value=\"nl\">dutch</option>\n");
37: print("</select>\n");
38: print("<input type=\"submit\">\n");
39: print("</form>\n");
40: print("<form name=\"register\" action=\""
41: + getSubmissionQueryUrl("register")
42: + "\" method=\"post\">\n");
43: print("<input name=\"login\" type=\"text\">\n");
44: print("<input name=\"password\" type=\"password\">\n");
45: print("<input name=\"firstname\" type=\"text\">\n");
46: print("<input name=\"lastname\" type=\"text\">\n");
47: print("<input type=\"submit\">\n");
48: print("</form>\n");
49: print("</body></html>\n");
50: }
51: }
52: }
|