Results 1 to 3 of 3

Thread: Form Submit always going in Failure function (callback)

  1. #1

    Default Form Submit always going in Failure function (callback)

    Hello All,

    Kindly help in one issue:-

    Form Submit always going in Failure function (callback) even though success is returned in the JSON response, below is my code:-

    headerDetailForm.submit({
    clientValidation: false, //done above
    url : isNewLead ? '/leadmanagementservice/addLead' : '/leadmanagementservice/updateLead',
    method: 'POST',
    params: {
    requestOrganizationId: headerDetailForm.findField('operUnitId').getValue(),
    OU: User.ou,
    requestOrganizationId : User.ou ,
    organizationId :User.swbOu,
    responsibilityId : User.swbResponsibilityId,
    id : isNewLead ? '' : headerDetailForm.findField('id').getValue()
    },
    success: function(form, action) {
    //this === view
    var data, toolbar, field;
    mask.hide().destroy();
    -------------------------
    }

    Json Response:-

    {"leadmanagementservicedata": {
    "responseStatus": {
    "returnCode": 0,
    "returnMessage": "Lead Updated"
    },
    "success": true,
    "total": 1,
    "lead": {
    "id": 190,
    "leadNumber": 62,
    "ownerId": 0,
    "company": "Frank's Company NE"
    }
    }}

    Here is the code of the form:-

    Ext.define('LWB.view.form.LeadDetail', {
    extend: 'Ext.form.Panel',
    alias: 'widget.leadheaderform',
    requires: ['LWB.model.LeadHeader'],
    title: 'Lead Header',
    bodyPadding: 0,
    autoScroll: true,
    bodyCls: 'swb-form-panel',
    layout: 'absolute',
    reader: new Ext.data.JsonReader({
    root: 'leadmanagementservicedata.lead',
    successProperty: 'leadmanagementservicedata.success',
    model: 'LWB.model.LeadHeader',
    }),
    ------------
    ------------

    Every time after the form submit, the control goes into failure block, even though the json response has success as true and it is a valid json.

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    Does your code have a file upload in it?
    http://www.sencha.com/forum/showthread.php?282364

    In your JSON response, does it work if you move "success": true to be outside of the leadmanagementservicedata block?

  3. #3

    Default

    Thanks Gary for your response.

    No my code doesnt have a file upload.

    And yes if i move 'success' up from my leadmanagementservice data block it works properly.

    But i have to make it work in this way only, because while configuring the Json Reader in my form I am defining the success property as leadmanagementservicedata.success so ideally it should work properly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •