Hi,
I’m trying to return the form id of the inserted record and not getting any response. My server code saves correctly and I have the following function:
function responseXML($action){
global $form;
$id = $action->get_id();
header("Content-type:text/xml");
echo "<data><action type='inserted' sid='".$id."' tid='".$id."' /></data>";
}
$form->event->attach(“afterProcessing”, “responseXML”);
On the client side, I have:
dp_form.attachEvent(“onAfterUpdateFinish”,function(loader){ alert(loader.xmlDoc.responseText);
});
When I click form.save() button, it saves but I get no xml response for me to see record id.
Appreciate if you can please assist.
Thanks,
Brian
I’m not quite sure why you are otputing your custom XML instead of the default one ( connector will generate xml response automatically )
Anyway, if you wish to have your custom response, you need to add
echo “”;
die(); //must be added
if process is not stopped, connector will block and ignore all “echo” generated response.
Hi Stanislav,
Thanks for your response. The reason is that when I do a form.save(), I’m trying to find a way to retrieve the record id for new inserted record and set it equal to a variable to perform other functions per the following unanswered post of mine:
viewtopic.php?f=17&t=30776
For some reason the below didn’t work, is there a better way to get the record Id per the above posted link?
Thanks,
Brian
Hi Stanislav,
Poking around, I think I got it sorted with this code:
dpf.attachEvent("onAfterUpdate",function(sid,action,tid,xml_node){
form.setItemValue("id",tid);
});
per docs.dhtmlx.com/doku.php?id=tuto … savingform
If there’s anything else further to consider, please let me know.
Cheers,
Brian