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
click:"editForm.update()"...

2.editForm.update is called which fires off the callback

editForm.saveData(editForm.updateCallBack);
  1. The callback then checks if a error is returned and displays.
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

<response>
	<status>1</status>
	<data>
	      <record>
			<error>Error:Message</error>
		</record>
	</data>
</response>';

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

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.

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 :slight_smile:

Yes, they are right here.