1. #1
    Ext User
    Join Date
    Jan 2009
    Posts
    61
    Vote Rating
    2
    venu is on a distinguished road

      0  

    Default FormPanel submit response as json format

    FormPanel submit response as json format


    I am using GWT+GXT and JSon format.

    I am submitting the FormPanel and i want to get the response from server as json format.
    I added a listener to the formpanel but the FormEvent.resultHtml is coming as null.

    When i see it in firebug, the response is shown as :
    {"message":"Diagnosis Successfully created","success":true}

    How to get this string in FormEvent resultHtml field ?

    Code Snippet:

    form.addListener(Events.Submit, new Listener<FormEvent>() {
    public void handleEvent(FormEvent arg0) {
    GWT.log("Result ::"+arg0.resultHtml, null);
    }
    });

    Can anyone help me in solving this problem?
    If there is any alternate way to handle this, let me know.

    thx.

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,966
    Vote Rating
    130
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    You have to submit to the same domain as the hole page is running, as else you are not able to access the iframe. This is a secrurity restriction in browsers.

  3. #3
    Sencha User
    Join Date
    Apr 2008
    Posts
    141
    Vote Rating
    0
    armandoxxx is on a distinguished road

      0  

    Default


    this works for me !

    PHP Code:
    settingsForm.addListener(Events.Submit, new Listener<FormEvent>() {
                public 
    void handleEvent(FormEvent be) {

                    
    String response        be.resultHtml;
                    if(
    response.indexOf("<pre>") != -1) {
                        
    response response.substring(5response.length()-6);
                    }
                    
    JSONValue rspValue     JSONParser.parse(response);
                    
    JSONObject rspObj    rspValue.isObject();
                    
    Window.alert(rspObj.get("message").toString());
                    
                }
            }); 

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar