Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Blank record when validating

    Hi there,

    I am validating using a php file which contains the business rules. If it fails it returns an xml output with the error number and message. If it passed its added into sql, datasource is refresh and a success message is displayed. The problem is I get blank field on the local datasource after each button click. Any suggestions?




    Flow:

    1. User selects fields and clicks button
    Code:
    click:"editForm.update()"...
    2.editForm.update is called which fires off the callback

    Code:
    editForm.saveData(editForm.updateCallBack);
    3. The callback then checks if a error is returned and displays.
    Code:
    updateCallBack: function(dsResponse, data, dsRequest){
    		if(dsResponse.status >= 1){
    			isc.warn(data.error);
    		}
    		else{
    			isc.say('update successful');
    			//refresh database
    			//drops myData cache for new records
    			myData.data.invalidateCache();
    			
    		}
        }
    The xml output looks like this
    Code:
    <response>
    	<status>1</status>
    	<data>
    	      <record>
    			<error>Error:Message</error>
    		</record>
    	</data>
    </response>';

    #2
    Sorry posted in wrong thread. Is meant to be Technical Q&A

    Comment


      #3
      The status code is wrong. -1 (not 1) indicates a general error, there are other codes for validation errors specifically.

      You ordinarily wouldn't use invalidateCache(). The cache is updated automatically when you return a success response.

      Comment


        #4
        Hi again Isomorphic,

        When I changed the error response to -1 I can no longer have a data response (eg: data.error is empty) but it does fix the original problem.

        Also is there a list of each response code?

        eg -1 = General Error
        -4 = Validation Error

        Thanks for your patience :)

        Comment


          #5
          Yes, they are right here.

          Comment

          Working...
          X