Re: Enter button on forms with keel:command

Nathan Kontny <Nathan.Kontny-UgwZ4owrJFB8UrSeD/[email protected]> Tue, 15 Jun 2004 19:47:54 -0700
Newsgroups gmane.comp.java.keel.user
Message-ID <[email protected]>
Attached is a newer version of my patch.  I just added a new line character to
the new output of the command tag for formatting.  I also tested the effect of
the patch in FireFox and it works.  

The fix was to add another hidden element to the form with the same name and
value as the submit button thats created.  Does anyone know if this has
negative consequences? 




Quoting Nathan Kontny <Nathan.Kontny-UgwZ4owrJFB8UrSeD/[email protected]>:

> I noticed bug 887181 in Sourceforge where hitting the enter button causes
> the
> form to post without any values.  I don't really understand the solution and
> I
> have only tried it in IE, but here is some website talking about a fix for
> this
> (http://forums.devshed.com/t35386/s.html).  
> 
> Anyways,  I altered the CommandTag.java to do this, and its allowing me now
> to
> hit the enter button on forms.  Here is the patch, let me know if this works
> for you.  
> 
> -Nate
> 
>
CommandTagPatch.txt (text/plain, 1 KB)
Index: CommandTag.java
===================================================================
RCS file: /cvsroot/keel/clnt-struts/src/java/org/keel/clients/struts/CommandTag.java,v
retrieving revision 1.8
diff -u -r1.8 CommandTag.java
--- CommandTag.java	23 Feb 2004 21:26:58 -0000	1.8
+++ CommandTag.java	16 Jun 2004 02:41:38 -0000
@@ -313,6 +313,16 @@
             results.append(prepareEventHandlers());
             results.append(prepareStyles());
             results.append(">");
+            
+            //Added this element so that the enter button works to submit the form
+            results.append("\n");
+            results.append("<input type=\"hidden\" name=\"");
+            results.append("COMMAND_" + commandName);
+            results.append("\"");
+            results.append(" value=\"");
+            results.append(commandLabel);
+            results.append("\"");
+            results.append(">\n");
 
             // Render this element to our writer
             ResponseUtils.write(pageContext, results.toString());