Search code examples
cssgwtformpanel

GWT FormPanel and submitting data to server


I've a GWT app that I need to put FormPanel to wrap a textbox (TextBox). (to solve some styling issue)

EDIT: The style issue is that: we are using some pre-build style sheet which put styles by HTML tag names .. so we need to put a form tag to wrap some components in order to be able to read the styles!

the problem is, on the KeyPress event, I notice there is a loading in the page appears. although the result returns ajaxaly as if there's no client-server trip happened.

The question is, How to remove this trip to server?

NOTE: i am just wrapping the componenets into the formpanel, I've not set any properties of it:

FormPanel formPanel = new FormPanel();
CaptionPanel captionPanel = new CaptionPanel();
formPanel.add(captionPanel);
captionPanel.add(horizontalPanel);
verticalPanel.add(formPanel);

Thanks.


Solution

  • From your question, it isn't clear that what is causing the trip to the server. But if it is the FormPanel that's causing this, I would change the instantiation of the FormPanel to the following:

    FormPanel formPanel = new FormPanel() {
        public boolean onFormSubmit() { return false; }
    };
    

    This should be the equivalent of the following html, which will keep the form from submitting:

    <form onsubmit="return false">
    

    If this doesn't fix it, you'll need to do some more debugging to see where the server is being called. The Tamper Data plug-in for Firefox might be of help for this.