1. #1
    Ext User
    Join Date
    Aug 2008
    Posts
    121
    Vote Rating
    0
    sheddy is on a distinguished road

      0  

    Default ext-all-debug error by submitting a form

    ext-all-debug error by submitting a form


    Hi!
    I want to submit a form by using the formPanels submit-method. The values will be send to the server and a JSP will process the data correctly. I've done this several times, but now i am getting an error. The JSP is executed correctly. This means that the JSPs result is what i want.
    BUT then the error occurs:
    syntax error ............ ext-all-debug.js (line 6685)
    )
    In this line is: "Ext.decode = Ext.util.JSON.decode;"

    My first working-form send the values to server and the response in firebug is:
    "Loading...", the 'success'-config option in the submit-method is executed and the request is done.

    But now i am getting no response.

    Please help...

    regards sdy

  2. #2
    Ext User
    Join Date
    Aug 2008
    Posts
    121
    Vote Rating
    0
    sheddy is on a distinguished road

      0  

    Default


    if it's helpful - my submit-method (it's working in my other forms):

    Code:
    [...]
    buttons:[{
            text: 'Save',
            handler: function (){        
            myForm.getForm().submit({
                url: 'save.jsp',
                method:'POST',
                success: function(response, options) { alert("success");},
                 failure: function(response, options) { alert("failure");}
            });
        }}]
    [...]

  3. #3
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Are you returning the correct JSON data for a success?

  4. #4
    Ext User
    Join Date
    Aug 2008
    Posts
    121
    Vote Rating
    0
    sheddy is on a distinguished road

      0  

    Default


    ehm...i am returning NO data, because my JSP shall only process the data. I do not need the response. Because my first form works and the response is "Loading..." in firebug (as i said).
    Well, should i send JSON back for accuracy and integrity?!

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Yes, or you could change the errorReader, e.g.

    Code:
    errorReader: {
      read: function(response) {
        return {success: true};
      }
    }

  6. #6
    Ext User
    Join Date
    Aug 2008
    Posts
    121
    Vote Rating
    0
    sheddy is on a distinguished road

      0  

    Default


    hmm...i don't know where to put the error reader you described, but i read the API, copied the code
    Code:
    {
        success: false,
        errors: {
            clientCode: "Client not found",
            portOfLoading: "This field must not be null"
        }
    }
    to my JSP, changed "success" to "true" and it works (i think, it doesn't matter whether i set success to true or false, the code is only needed to pretend the error)! is that correct? or have i to put something into my js-file?!

  7. #7
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Simply returning {success:true} is enough.

    The errorReader is a config option of BasicForm (and also of FormPanel), so you should add it to the form config.
    This errorReader config I posted overrides any data coming from the server (which in your case was empty) with {success: true}.

  8. #8
    Ext User
    Join Date
    Aug 2008
    Posts
    121
    Vote Rating
    0
    sheddy is on a distinguished road

      0  

    Default


    ah okay, i understand

    either i return {success: true} from server or i set the config option "errorReader" in form.

    thank your for your help

    regards sdy

Thread Participants: 1