You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jc...@apache.org on 2007/05/01 11:38:00 UTC

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

Author: jcompagner
Date: Tue May  1 02:37:59 2007
New Revision: 533985

URL: http://svn.apache.org/viewvc?view=rev&rev=533985
Log:
we really can't just terminate <button tag for the Button component! (it did break all our solutions!)
i now only output the value string if it is a <input > what about the name attribute can that be always included?

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=533985&r1=533984&r2=533985
==============================================================================
--- 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 Tue May  1 02:37:59 2007
@@ -18,6 +18,7 @@
 
 import org.apache.wicket.markup.ComponentTag;
 import org.apache.wicket.model.IModel;
+import org.apache.wicket.util.string.Strings;
 import org.apache.wicket.version.undo.Change;
 
 /**
@@ -190,22 +191,24 @@
 	 */
 	protected void onComponentTag(final ComponentTag tag)
 	{
-		checkComponentTag(tag, "input");
-
 		// Default handling for component tag
 		super.onComponentTag(tag);
 
-		try
+		String name = tag.getName();
+		if (Strings.isEqual("input", name))
 		{
-			String value = getModelObjectAsString();
-			if (value != null && !"".equals(value))
+			try
 			{
-				tag.put("value", value);
+				String value = getModelObjectAsString();
+				if (value != null && !"".equals(value))
+				{
+					tag.put("value", value);
+				}
+			}
+			catch (Exception e)
+			{
+				// ignore.
 			}
-		}
-		catch (Exception e)
-		{
-			// ignore.
 		}
 
 		// If the subclass specified javascript, use that



Re: Button does not handle

Posted by Johan Compagner <jc...@gmail.com>.
it handles it fine!
it works perfectly in my solutions i have here except when you made that
check
then everything broke for me.

and see my other post <button type="submit"> is or should be the same as
<input type="submit">


johan


On 5/2/07, Jean-Baptiste Quenot <jb...@apache.org> wrote:
>
> * jcompagner@apache.org:
> > Author: jcompagner
> > Date: Tue May  1 02:37:59 2007
> > New Revision: 533985
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=533985
> > Log:
> > we really can't just terminate <button tag for the Button component! (it
> did break all our solutions!)
> > i now only output the value string if it is a <input > what about the
> name attribute can that be always included?
> >
> > Modified:
> >     incubator/wicket/trunk/jdk-1.4
> /wicket/src/main/java/org/apache/wicket/markup/html/form/Button.java
> >
> >       protected void onComponentTag(final ComponentTag tag)
> >       {
> > -             checkComponentTag(tag, "input");
> > -
> >               // Default handling for component tag
> >               super.onComponentTag(tag);
>
> Hi Johan,
>
> I changed the code to enforce the use of <input> because Button
> does not work with <button>, confirmed by Igor on IRC.
>
> If you really want a <button> you should use a Link instead.  Or
> if you really want Button, use <input> instead.  Currently it's
> not obvious for users that Button does not handle <button>, so
> please update your code so that we can bring back the <input> tag
> check.
>
> Cheers,
> --
>      Jean-Baptiste Quenot
> aka  John Banana   Qwerty
> http://caraldi.com/jbq/
>

Re: Button does not handle

Posted by Johan Compagner <jc...@gmail.com>.
jip thats my idea.
developers shouldn't be thinking of those things that will just make it
harder
if they think they dropped a button (what ever type it is <input
type="button" or type="submit"> or <button>
it just should work.

johan


On 5/2/07, Eelco Hillenius <ee...@gmail.com> wrote:
>
> Actually, tbh, I think it's kind of ugly we Buttons and SubmitLinks as
> separate entities. Imo, a really good solution would be to just have
> Button, that works on anything Button and SubmitLink work on now.
>
> Eelco
>
> On 5/2/07, Jean-Baptiste Quenot <jb...@apache.org> wrote:
> > * jcompagner@apache.org:
> > > Author: jcompagner
> > > Date: Tue May  1 02:37:59 2007
> > > New Revision: 533985
> > >
> > > URL: http://svn.apache.org/viewvc?view=rev&rev=533985
> > > Log:
> > > we really can't just terminate <button tag for the Button component!
> (it did break all our solutions!)
> > > i now only output the value string if it is a <input > what about the
> name attribute can that be always included?
> > >
> > > Modified:
> > >     incubator/wicket/trunk/jdk-1.4
> /wicket/src/main/java/org/apache/wicket/markup/html/form/Button.java
> > >
> > >       protected void onComponentTag(final ComponentTag tag)
> > >       {
> > > -             checkComponentTag(tag, "input");
> > > -
> > >               // Default handling for component tag
> > >               super.onComponentTag(tag);
> >
> > Hi Johan,
> >
> > I changed the code to enforce the use of <input> because Button
> > does not work with <button>, confirmed by Igor on IRC.
> >
> > If you really want a <button> you should use a Link instead.  Or
> > if you really want Button, use <input> instead.  Currently it's
> > not obvious for users that Button does not handle <button>, so
> > please update your code so that we can bring back the <input> tag
> > check.
> >
> > Cheers,
> > --
> >      Jean-Baptiste Quenot
> > aka  John Banana   Qwerty
> > http://caraldi.com/jbq/
> >
>

Re: Button does not handle

Posted by Eelco Hillenius <ee...@gmail.com>.
Actually, tbh, I think it's kind of ugly we Buttons and SubmitLinks as
separate entities. Imo, a really good solution would be to just have
Button, that works on anything Button and SubmitLink work on now.

Eelco

On 5/2/07, Jean-Baptiste Quenot <jb...@apache.org> wrote:
> * jcompagner@apache.org:
> > Author: jcompagner
> > Date: Tue May  1 02:37:59 2007
> > New Revision: 533985
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=533985
> > Log:
> > we really can't just terminate <button tag for the Button component! (it did break all our solutions!)
> > i now only output the value string if it is a <input > what about the name attribute can that be always included?
> >
> > Modified:
> >     incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Button.java
> >
> >       protected void onComponentTag(final ComponentTag tag)
> >       {
> > -             checkComponentTag(tag, "input");
> > -
> >               // Default handling for component tag
> >               super.onComponentTag(tag);
>
> Hi Johan,
>
> I changed the code to enforce the use of <input> because Button
> does not work with <button>, confirmed by Igor on IRC.
>
> If you really want a <button> you should use a Link instead.  Or
> if you really want Button, use <input> instead.  Currently it's
> not obvious for users that Button does not handle <button>, so
> please update your code so that we can bring back the <input> tag
> check.
>
> Cheers,
> --
>      Jean-Baptiste Quenot
> aka  John Banana   Qwerty
> http://caraldi.com/jbq/
>

Re: Button does not handle

Posted by Jean-Baptiste Quenot <jb...@apache.org>.
* jcompagner@apache.org:
> Author: jcompagner
> Date: Tue May  1 02:37:59 2007
> New Revision: 533985
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=533985
> Log:
> we really can't just terminate <button tag for the Button component! (it did break all our solutions!)
> i now only output the value string if it is a <input > what about the name attribute can that be always included?
> 
> Modified:
>     incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Button.java
> 
>  	protected void onComponentTag(final ComponentTag tag)
>  	{
> -		checkComponentTag(tag, "input");
> -
>  		// Default handling for component tag
>  		super.onComponentTag(tag);

Hi Johan,

I changed the code to enforce the use of <input> because Button
does not work with <button>, confirmed by Igor on IRC.

If you really want a <button> you should use a Link instead.  Or
if you really want Button, use <input> instead.  Currently it's
not obvious for users that Button does not handle <button>, so
please update your code so that we can bring back the <input> tag
check.

Cheers,
-- 
     Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/