PDA

View Full Version : form submit xml data ?



muncher
1 Jul 2010, 9:10 PM
how do I submit the form data in xml format ?
sample example submits it as query parameter.

Condor
2 Jul 2010, 12:14 AM
You will need to extend Ext.form.Action.Submit to submit the data in XML format instead of urlencoded.

muncher
6 Jul 2010, 12:55 PM
bit confused.
Below is my code



<html>
<head>
<title>Complex Layout</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />


<!-- overrides to base library -->

<!-- page specific -->
<link rel="stylesheet" type="text/css" href="../shared/examples.css" />
<link rel="stylesheet" type="text/css" href="grid-examples.css" />

<style type="text/css">
html, body {
font:normal 12px verdana;
margin:0;
padding:0;
border:0 none;
overflow:hidden;
height:100%;
}
p {
margin:5px;
}
.settings {
background-image:url(../shared/icons/fam/folder_wrench.png);
}
.nav {
background-image:url(../shared/icons/fam/folder_go.png);
}
</style>


<!-- ** Javascript ** -->
<!-- ExtJS library: base/adapter -->
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>

<!-- ExtJS library: all widgets -->
<script type="text/javascript" src="../../ext-all.js"></script>

<!-- overrides to base library -->

<!-- extensions -->
<script type="text/javascript" src="../ux/CheckColumn.js"></script>

<!-- page specific -->
<script type="text/javascript" src="../shared/examples.js"></script>





<script type="text/javascript">
Ext.onReady(function(){

var simple = new Ext.form.FormPanel({


standardSubmit: true,


frame:true,
title: 'Register',

width: 350,
defaults: {width: 230},
defaultType: 'textfield',
items: [{
fieldLabel: 'Username',
name: 'username',
allowBlank:false
},
{
inputType: 'hidden',
id: 'submitbutton',
name: 'myhiddenbutton',
value: 'hiddenvalue'
}

],
buttons: [{
text: 'Submit',
handler: function() {
simple.getForm().getEl().dom.action = 'test.php';
simple.getForm().getEl().dom.method = 'POST';
simple.getForm().submit();

}
}]


});



simple.render('mytraditionalform');



});
</script>
</head>
<body>
<div id="mytraditionalform"></div>
</body>
</html>




how and where do I use the extended Ext.form.Action.Submit in the above code ?

muncher
6 Jul 2010, 2:10 PM
cool. found it.
but how do I post that xml ?

The ajax Request is as -


Ext.Ajax.request(Ext.apply(this.createCallback(o), {
url:this.getUrl(!isPost),
method: method,
params:params, //add our values
isUpload: this.form.fileUpload
}));


and my xml string is stored in xmldata, should I replace params with xmldata ?

Condor
6 Jul 2010, 10:45 PM
1. This will never work if you are using standardSubmit:true.
2. Correct. Replace params:params with xmlData:myParamsAsAnXmlString