[tools 1/2] testbot/cgi: Add support for nameless actions.

Francois Gouget fgouget at codeweavers.com
Mon Mar 28 10:32:34 CDT 2022


Action names starting with a dot will not be sent to the form page. This
can be useful to get a clean 'get' URL.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/lib/ObjectModel/CGI/FormPage.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/testbot/lib/ObjectModel/CGI/FormPage.pm b/testbot/lib/ObjectModel/CGI/FormPage.pm
index 2565c077b..83b078b24 100644
--- a/testbot/lib/ObjectModel/CGI/FormPage.pm
+++ b/testbot/lib/ObjectModel/CGI/FormPage.pm
@@ -555,6 +555,11 @@ Returns a list of actions that can be applied after completing or reading this
 form. Each action is a string which is used as the label of a button at the
 bottom of the form.
 
+If an action name starts with a dot, the button label omits the dot and the
+corresponding <input> field gets no name attribute. Note that this means the
+action name is not sent to the form so it probably does not make sense to have
+more than one such action per form.
+
 By default there is no action.
 
 =back
@@ -573,7 +578,9 @@ sub GenerateActions($)
   print "<div class='ItemActions'>\n";
   foreach my $Action (@{$self->GetActions()})
   {
-    print "<input type='submit' name='Action' value='$Action'/>\n";
+    print "<input type='submit' ";
+    print "name='Action' " if ($Action !~ s/^\.//);
+    print "value='$Action'/>\n";
   }
   print "</div>\n";
 }
-- 
2.30.2




More information about the wine-devel mailing list