Google Groups Home
Help | Sign in
Message from discussion button within a form
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
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.
sluramod wrote:
> 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.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google