1. #1
    Sencha User
    Join Date
    Apr 2008
    Posts
    330
    Vote Rating
    0
    Jack_S is on a distinguished road

      0  

    Question Ext.util.JSON.decode(form,action) - Ext.Msg.show()

    Ext.util.JSON.decode(form,action) - Ext.Msg.show()


    Hello All,

    I'm submitting a very simple form (2 fields) using form.submit(). I have no errors what so ever, rather my error handling is not being launched.

    I have created a unique contraint on a field. When contraint is violated I send back the below JSON (verified correct syntax in JSLint).

    Code:
    {"success": false, "errCode":"-1", "errMsg":"ORA-00001: unique constraint (ORIFLAME.ORI_CIRCUITS_CON1
    
    ) violated"}
    So now all my code seems correct, and when success is true, then everything goes alright. Is there something I am doing wrong....

    Thanks in Advance

    Jack

    Code:
    ,handler: function(){
    	if (circuitInsertForm.getForm().isValid()) {
                  circuitInsertForm.getForm().submit({
    		waitMsg:'Saving Data...'
    		,url: baseURL + '/wwv_flow.show?p_flow_id='+$v('pFlowId')+'&p_flow_step_id=0&p_instance='+$v('pInstance')+'&p_request=APPLICATION_PROCESS%3DINSERT_CIRCUIT'
    
                    ,success: function(form,action){
                      var json = Ext.util.JSON.decode(action.response.responseText);
                          
                      if(json.success !== true) {
                        Ext.Msg.show({
                           title: json.errCode
                          ,msg:Ext.util.Format.ellipsis(json.errMsg, 2000)
                          ,icon:Ext.Msg.ERROR
                          ,buttons:Ext.Msg.OK
                          ,minWidth:1200 > String(json.errMsg).length ? 360 : 600
                        });
                      } else {
                        store.reload();
                        circuitInsertWindow.hide();
                      }
                    }
    		});
    	}else {
                    Ext.MessageBox.show({
    			title: 'Error'
    			,buttons: Ext.MessageBox.OK
    			,icon: Ext.MessageBox.ERROR
    			,msg: 'Please make sure all fields are filled!'
    		});
                  }
    						}

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    91
    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


    The failure handler (and not the success handler) will be called if you set success:false.

    ps. You can use:
    Code:
    var json = action.result;
    (as long as you don't use an errorReader)

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

      0  

    Thumbs up


    Thanks Condor, Spot on!!

Thread Participants: 1