From cf9dc555ca508278042c590a52bdb5d106c8f79d Mon Sep 17 00:00:00 2001 From: mdb Date: Thu, 1 Nov 2001 00:35:05 +0000 Subject: [PATCH] Added action() and submit() which make doing standard things like a hidden form field named "action" and a submit button named "submit" more convenient. git-svn-id: https://samskivert.googlecode.com/svn/trunk@404 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../com/samskivert/velocity/FormTool.java | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/projects/samskivert/src/java/com/samskivert/velocity/FormTool.java b/projects/samskivert/src/java/com/samskivert/velocity/FormTool.java index 18adf3e6..0012174b 100644 --- a/projects/samskivert/src/java/com/samskivert/velocity/FormTool.java +++ b/projects/samskivert/src/java/com/samskivert/velocity/FormTool.java @@ -1,5 +1,5 @@ // -// $Id: FormTool.java,v 1.3 2001/11/01 00:28:30 mdb Exp $ +// $Id: FormTool.java,v 1.4 2001/11/01 00:35:05 mdb Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -130,6 +130,15 @@ public class FormTool return input("password", name, extra, defaultValue); } + /** + * Constructs a submit element with the name submit and + * the specified button text. + */ + public String submit (String text) + { + return fixedInput("submit", "submit", text, ""); + } + /** * Constructs a submit element with the specified parameter name and * the specified button text. @@ -169,6 +178,17 @@ public class FormTool return fixedInput("hidden", name, value, ""); } + /** + * Generates a hidden form field named action with the + * specified value. This is handy when you have multiple forms + * submitting to the same servlet and you need to distinguist the + * action desired by the user. + */ + public String action (String value) + { + return fixedInput("hidden", "action", value, ""); + } + /** * Constructs a checkbox input field with the specified name and * default value.