Hi,
I might be missing something here, so hopefully it’s something simple that someone can spot that I’m missing.
I’m trying to save data from a popup window (just like the popup from the Contact Manager sample).
studentsToolbar.attachEvent("onClick",function(id){
if(id=="addStudent"){
//open popup window
var popupWindow = layout.dhxWins.createWindow("newStudent_win", 0, 0, 400, 400);
popupWindow.center();
popupWindow.setText("New Student");
//add form
var addStudentForm = popupWindow.attachForm();
addStudentForm.loadStruct("xml/addStudentForm.xml");
//data
var dpfs = new dataProcessor("php/student_details.php");
dpfs.init(addStudentForm);
dpfs.attachEvent("onAfterUpdate", function(sid,action,tid,xml_node) {
alert(action);
//if(action=="inserted"){
// alert("inserted!");
// dpg.ignore(function() {
// studentsGrid.addRow(tid, [addStudentForm.getItemValue("firstName"),addStudentForm.getItemValue("lastName")], 0);
// alert("ignore!");
// })
//}
//studentsGrid.selectRowById(tid,false,false,true);
//popupWindow.close();
})
addStudentForm.attachEvent("onButtonClick", function(name, command){
dpfs.sendData();
alert("dpgs.sendData");
});
}
It seems like I can’t get dpfs to fire. I receive the alert “dpgs.sendData”, which indicates that it passes the event when I click on the “Save” button in the popup window. Data is also saved to the database. However, since dpfs doesn’t get to “onAfterUpdate”, I don’t get the alert for “action”, and the popup window doesn’t close (when the line is uncommented).
I also tried using “onAfterUpdateFinish”, that didn’t work either.
Thanks!
K.