PDA

View Full Version : HOW TO INSERT XML POST IN EXTJS FORM?



snehal
16 Aug 2009, 9:33 AM
hey there..i am a new learner of EXT JS...i am just on the basics of it..
currently my requirement is " the EXT JS form on submit should post the data filled in the this form,to another Data Form via an XML POST"...

Please help me on this feature so as to how to introduce the code of an XML Post in2 the EXT JS Form code..

For your assistance i am pasting the code,

var submit = fs.addButton({
text: 'Submit',
disabled:false,
handler: function runpost()
{
if (window.XMLHttpRequest)
{
xmlDoc=new window.XMLHttpRequest();
xmlDoc.open("GET","xml-form.xml",false);
xmlDoc.send("");
xmlDoc=xmlDoc.responseXML;
}
// IE 5 and IE 6
else if (ActiveXObject("Microsoft.XMLDOM"))
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.load("xml-form.xml");
}


function checkReadyState(obj) {
if(obj.readyState == 4) {
if(obj.status == 200) {
return true;
}
else {
alert("Problem sending XML data");
}
}
else {
return false;
}
}

//xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
//xmlDoc.async=true;

var xml_message = "<sc_record>";
// ALIASES in the Data form SHOULD MATCH THE TAG NAMES BELOW.
//xml_message += "<dpg_industry>MU</dpg_industry>";
xml_message += "<first>"+ document.getElementById("first").value +"</first>";
//xml_message += "<employee_id>"+ document.getElementById("employee_id").value +"</employee_id>";
xml_message += "</sc_record>";
alert (xml_message);

var url = "value of url";
xmlDoc.loadXML(xml_message.replace(/&/g, "&amp;"));

//sendRequest(url,xmlDoc);



fs.form.submit({url:'value of url', waitMsg:'Saving Data...'});
sendRequest(url,xmlDoc);
return xmlDoc;

}



});

The Bug i am getting is: "Automation server can't create the object"..