I have a form that I use a grid to populate the form by choosing the selected itemto populate. When I send the form to the php the first time Im good and the record deletes. If I choose another record and try to delete it the hidden fields do not get sent to the php file.
var selectedItem = locgrid.getSelectedRowId();
if (locForm)
{
return;
}
else
{
var formData = [
{type: "settings", position: "label-left", labelWidth: 100, inputWidth: 120},
{type: "fieldset", label: "Locations", inputWidth: "auto", list:[
{type: "input", label: "Name", name: "Name", value: ""},
{type: "hidden", label: "switch", name:"switch", value: "3"},
{type: "hidden", label: "usrid", name:"usrid", value: "7000"},
{type: "hidden", label: "cmpid", name:"cmpid", value: "5000"},
{type: "hidden", label: "Table", name:"Table", value: "Location"},
{type: "newcolumn"},
{type: "button", value: "Save", name: "save"},
{type: "newcolumn"},
{type: "button", value: "Delete", name: "del"}
]}
];
locForm = new dhtmlXForm("loc_Form", formData);
locForm.setSkin("dhx_skyblue");
locForm.load("php/data_location.php?id=" + selectedItem);
//var Formdp = new dataProcessor("php/data_location.php");
//Formdp.init(myForm);
locForm.attachEvent("onButtonClick", function(id){
if(id=="save")
{
//locForm.save();
locForm.send("php/sqladdloc.php");
locForm.clear();
locForm.reset();
doInitGrid();
}
else
{
//locgrid.deleteRow(selectedItem);
locForm.send("php/del.php");
//locForm.clear();
//locForm.reset();
doInitGrid();
}
});
}
function doOnRowSelected1()
{
var selectedItem = locgrid.getSelectedRowId();
locForm.load("php/data_location.php?id=" + selectedItem);
}
locgrid = new dhtmlXGridObject(‘locgrid_container’);
locgrid.setImagePath(“dhtmlx/dhtmlxgrid/codebase/imgs/”);
locgrid.setHeader(“Name”);
locgrid.setInitWidths("*");
locgrid.setColAlign(“left”);
locgrid.setSkin(“light”);
locgrid.setColumnIds(“Name”);
locgrid.load(“php/connector_loc.php”);
locgrid.init();
locgrid.attachEvent(“onRowSelect”, doOnRowSelected1);
var locdp = new dataProcessor(“php/connector_loc.php”);
locdp.init(catgrid);
locdp.setUpdateMode(“cell”,true)
locdp.setDataColumns(“true”);