I want to use dhtmlx to produce a web app which works when no internet connection is available. I’ve got loading data from the server and navigating pages offline working just fine thanks to “dhx.proxy” but I don’t understand how to use the proxy facility to capture data to be sent to the server.
Note: I do NOT want to use dataProcessor or dhtmlxConnector because I already have server side PHP code for serving data and updating the database etc. (this is an existing app I’m re-writing for iPad users).
Given this code:-
save_data = new dhx.proxy({
url: "save.php",
storage: dhx.storage.local
});
dhx.ui({
view:"form", id:"myform", elements:[
{ view:"text", label:"Label 1", id:"field1" },
{ view:"text", label:"Label 2", id:"field2" },
{ view:"text", label:"Label 3", id:"field3" },
{ view:"button", label:"Save", click:"save_form" }
]
});
function save_form() {
save_data.post($$('myform').getValues(),{
error: function(r,x,h){
alert('ERROR: '+r);
},
success: function(r,x,h){
alert(r);
}
});
}
Saving the form to the server works fine when the iPad is connected, and an alert box appears displaying a reply from the server, but nothing at all happens when it’s not connected, no alert box is displayed, not even showing "ERROR: ".
What exactly is supposed to go in the error and success callbacks of the proxy.post() method?