Send() and custom return value

Hi,

I have very simple aplication on dhtmlx framework. That is layout with grid and form.
On grid I show rows from sql database. For example that are tree columns (ID,Name,LastName).
When I would like add a new record I fill two fields on form (for example- Name, LastName) and with send() function I call php file. In PHP I call stored procedure on sql server that insert this two values to database.
Validation is in stored procedure so there is two options as a result of execute procedure:
First- everything was ok and I added a record so I return to php script value ID of new record.
Second- Something was wrong and I return to php message with validation error.

When record was added- I would like back to my dhtmlx aplication value with ID of new record (and then refresh grid and select new record)

When record was not added - I would like back error from php file.

Is there any option to do something like this with use send() or save() functions?

Thanks in advance (and sorry for my English… I still learning :slight_smile: )
T.

You can use save() method and dhtmlxDataProcessor events. save() method used DataProcessor to send data to the server side. So after update is finished, you can use “onAfterUpdateFinish” event to handler server response:

myForm.save(); var dp = new dataProcessor("php/data.php"); dp.init(myForm); dp.attachEvent("onAfterUpdateFinish",function(){ //your code here });

Hi,

Thank, that was what I looking for. For anyone who will have similar problem here is a better example.

T.