I created a form container and attached a grid into it… Right now, i’m trying to submit the data to insert the form info (and the selected item in the grid) into the db.
However, when I try to do this, the information from the grid doesn’t get submitted because I think its not submitted as a form. I’ve read that I could use mygrid.parentFormOnSubmit(); but when I try that, it says object has no such method.
Here’s a snippet of my codes:
formData = [{type: “input”,
name: “Name”,
label: “Full Name”,
value: “Name”,
readonly: “true”,
required: “true”
}, {
type: “container”,
name: “Equipments”,
label: “Select Equipment”,
inputWidth: 330,
inputHeight: 200
}, {
type: “button”,
value: “OK”,
name: “send_button”
}, {
type: “button”,
value: “Cancel”
}, {
}];
myform = new dhtmlXForm("formbox",formData);
//myform.loadStruct("invoice_form.xml");
myform.bind(mygrid);
Sorry accidentally submitted before posting the entire snippet. Here’s the grid part:
equipmentlist = new dhtmlXGridObject(myform.getContainer("Equipments"));
equipmentlist.setHeader("Name, Description, Accessories, Cost")
equipmentlist.setColumnIds("Name, Description, Accessories, Cost")
equipmentlist.setColTypes("ro,ro,ro,ro");
equipmentlist.enableMultiselect(true);
equipmentlist.load("equipment_connector_grid.php");
equipmentlist.init();
myform.attachEvent("onButtonClick", function(id){
if(id=="send_button"){
myform.send("invoice_db.php", "post", function(loader, response){
alert(response);
});
}
});
Andrei
July 25, 2013, 10:47am
#3
Hi
I think its not submitted as a form
correct
you need to submit it manualy
also you can try something like this:
add {type:“hidden”, name: “gridSelectedId”, value: null}
grid.attachEvent(“onRowSelect”, function(id){
myForm.setItemValue(“gridSelectedId”, id);
});
form loading - back steps