Author: jbq
Date: Sat May  5 07:04:38 2007
New Revision: 535523

URL: http://svn.apache.org/viewvc?view=rev&rev=535523
Log:
Actually, a <button> is allowed to have a value attribute, see
http://www.w3.org/TR/html4/interact/forms.html#adef-value-BUTTON

Improving the Javadoc

Modified:
    
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Button.java

Modified: 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Button.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Button.java?view=diff&rev=535523&r1=535522&r2=535523
==============================================================================
--- 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Button.java
 (original)
+++ 
incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Button.java
 Sat May  5 07:04:38 2007
@@ -183,7 +183,15 @@
        }
 
        /**
-        * Processes the component tag.
+        * Processes the component tag. A <tt>value</tt> attribute is added with
+        * the value of the model object, if available. An <tt>onclick</tt>
+        * attribute is added if the subclass specified javascript.
+        * 
+        * <p>
+        * <b>NOTE</b>. For a <tt>&lt;button&gt;</tt> the <tt>value</tt>
+        * attribute is not rendered, markup needs to be added within the button
+        * to display the button's label.
+        * </p>
         * 
         * @param tag
         *            Tag to modify
@@ -195,20 +203,18 @@
                super.onComponentTag(tag);
 
                String name = tag.getName();
-               if (Strings.isEqual("input", name))
+
+               try
                {
-                       try
+                       String value = getModelObjectAsString();
+                       if (value != null && !"".equals(value))
                        {
-                               String value = getModelObjectAsString();
-                               if (value != null && !"".equals(value))
-                               {
-                                       tag.put("value", value);
-                               }
-                       }
-                       catch (Exception e)
-                       {
-                               // ignore.
+                               tag.put("value", value);
                        }
+               }
+               catch (Exception e)
+               {
+                       // ignore.
                }
 
                // If the subclass specified javascript, use that


Reply via email to