Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
button within a form
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
sluramod  
View profile  
(3 users)  More options Aug 14 2006, 6:02 pm
From: "sluramod" <alexei.soko...@gmail.com>
Date: Mon, 14 Aug 2006 15:02:34 -0700
Local: Mon, Aug 14 2006 6:02 pm
Subject: button within a form
Hello,

I noticed a bug in 1.1.0 release. If you place a button inside
FormPanel, then if you click the button it will submit the form in all
browsers except IE. You can use this code to fix the problem:

package com.whatever.gwt.client;

import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;

public class FormButton extends Button {

        /**
         * Creates a button with no caption.
         */
        public FormButton() {
                super();
                fixButton(getElement());
        }

        /**
         * Creates a button with the given HTML caption.
         *
         * @param html
         *            the HTML caption
         */
        public FormButton(String html) {
                super(html);
                fixButton(getElement());
        }

        /**
         * Creates a button with the given HTML caption and click listener.
         *
         * @param html
         *            the HTML caption
         * @param listener
         *            the click listener
         */
        public FormButton(String html, ClickListener listener) {
                super(html, listener);
                fixButton(getElement());
        }

        public static native void fixButton(Element e) /*-{
         if (e.type == 'submit') {
         e.type = 'button';
         }
         }-*/;

}

Hope this helps,
Alexei

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
hoosie  
View profile  
 More options Aug 15 2006, 1:40 am
From: "hoosie" <hoosiem...@gmail.com>
Date: Mon, 14 Aug 2006 22:40:28 -0700
Local: Tues, Aug 15 2006 1:40 am
Subject: Re: button within a form
Thanks Alexei!  Just ran into this problem, Firefox was submitting
forms twice (or popping up the validation error messages twice).  Your
FormButton class completely fixed the problem.

-Ian


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
dan_lat  
View profile  
 More options Aug 15 2006, 11:33 am
From: "dan_lat" <dan.lat...@gmail.com>
Date: Tue, 15 Aug 2006 08:33:48 -0700
Local: Tues, Aug 15 2006 11:33 am
Subject: Re: button within a form
Hi, the above code helped me a lot! thanks v much.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vivian  
View profile  
 More options Aug 16 2006, 3:48 am
From: "Vivian" <v...@google.com>
Date: Wed, 16 Aug 2006 07:48:27 -0000
Local: Wed, Aug 16 2006 3:48 am
Subject: Re: button within a form

According to the HTML spec
http://www.w3.org/TR/html4/interact/forms.html#edef-BUTTON, the default
for all <button> markup is type="submit" unless otherwise specified,
which is what happens in the Button constructor when it calls
DOM.createButton().  An alternative to using JSNI is to call
DOM.setAttribute(button.getElement(), "type", "button").

-Vivian


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
dan_lat  
View profile  
 More options Aug 16 2006, 11:12 am
From: "dan_lat" <dan.lat...@gmail.com>
Date: Wed, 16 Aug 2006 08:12:19 -0700
Local: Wed, Aug 16 2006 11:12 am
Subject: Re: button within a form
Hi Vivian, I am having the same problem as stated in 'hoosie' message
above, I implemented Alexis FormButton class and this fixed the
problem.. but, the problem has just re-appeared even using the
FormButton Class, do you have any suggestions as to what is causing
this? and any workarounds, thanks

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
dan_lat  
View profile  
(1 user)  More options Aug 17 2006, 3:52 am
From: "dan_lat" <dan.lat...@gmail.com>
Date: Thu, 17 Aug 2006 00:52:23 -0700
Local: Thurs, Aug 17 2006 3:52 am
Subject: Re: button within a form
my page seems to be doing the ame as this post:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa...

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
YUY0x7  
View profile  
(1 user)  More options Aug 22 2006, 6:14 pm
From: "YUY0x7" <gfa...@gmail.com>
Date: Tue, 22 Aug 2006 22:14:22 -0000
Local: Tues, Aug 22 2006 6:14 pm
Subject: Re: button within a form
Vivian, the line you're suggesting fails in IE for some reason. The GWT
shell tells me "Object does not support this operation". It works fine
in FF, though. The code posted by sluramod works for both browsers.

Thank you both.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google