Thursday, May 7, 2015

Re: SubmitCompleteEvent.getResults() always returns null

i'm facing the same problem actually ?? any help pls?

On Wednesday, May 8, 2013 at 6:09:56 PM UTC+3, Robson Braga wrote:
Hi guys,

I've a RESTful webservice that returns xml/json and it works properly.

If I submit a HTML form to that webservice, Firefox and Chrome shows the XML file, but when I try to submit a GWT FormPanel, on the onSubmitComplete callback, SubmitCompleteEvent.getResults() always returns null.

Here is my HTML code:

<html>
    <body>
        <form method="POST" action="http://localhost:8080/myWebService/entry">
            <input type="email" id="email" name="email" width="10"><br>
            <input type="password" id="password" name="password" width="10"><br>
            <input type="submit" value="Test">
        </form>
    </body>
</html>


Here is my GWT Code:

    public void onModuleLoad() {
        final FormPanel formPanel = new FormPanel();
        formPanel.setEncoding(FormPanel.ENCODING_URLENCODED);
        formPanel.setMethod(FormPanel.METHOD_POST);

        VerticalPanel verticalPanel = new VerticalPanel();

        verticalPanel.add(new Label("Username"));
        TextBox userid = new TextBox();
        userid.setName("email");
        verticalPanel.add(userid);

        verticalPanel.add(new Label("Password"));
        PasswordTextBox passwd = new PasswordTextBox();
        passwd.setName("password");
        verticalPanel.add(passwd);

        verticalPanel.add(new Button("Submit", new ClickHandler() {
            public void onClick(ClickEvent event) {
                formPanel.submit();
            }
        }));

        formPanel.add(verticalPanel);
        formPanel.setAction("http://localhost:8080/
myWebService/entry");
        formPanel.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {
            public void onSubmitComplete(SubmitCompleteEvent event) {
               Window.alert(event.getResults());
            }
        });

        RootPanel.get().add(formPanel);   
    }


What am I doing wrong? Am I forgetting something? Is there any SOP restriction? How do I bypass this issue?

Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment