defineAction

defines a handler function for a specific response status

void defineAction(string status,function handler);

Parameters

statusstringthe response status
handlerfunctiona handler function for processing the specified status of response

Example

myDataProcessor.defineAction("error",function(response){
    alert(response.firstChild.nodeValue);
    return true;
});

Related samples

Details

Status

There are 5 predefined statuses of response:

  1. updated
  2. inserted
  3. deleted
  4. invalid
  5. error

You can also specify some custom status and set it as the parameter:

//server side: PHP, dhtmlxConnector
function validate($data){
    if ($data->get_value("some")=="") $data->set_status("my_status")
}
$conn->event->attach("beforeProcessing","validate");
 
//client side:
dp.defineAction("my_status",function(response){
    //your custom code
    return true;
})

Handler function

The handler function takes 1 parameter:

  • response - the server response (in the XML Document format)
Back to top