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,971
    Vote Rating
    132
    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

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."