TonySteele
19 Mar 2010, 6:56 AM
I am trying to use Ext.Direct to submit form that has been extended.
In the following example the form guestbookform created on the fly works fine, the server method is called with the form parameters.
However the extended FormPanel, when created guestbookform2 and submitted results in a normal submit to the HTML page, the Ext.Direct api is not recognised.
Does anybody know why this is not working ?
Ext.Direct.addProvider(Ext.app.REMOTING_API);
guestbookForm2 = Ext.extend(Ext.form.FormPanel, {
initComponent: function() {
Ext.apply(this, {
api: {
submit: Guestbook.addEntry
},
id: 'aricle_form',
fileUpload: true,
border: false,
height: 250,
bodyStyle: 'padding: 15px;',
items: [{
xtype: 'textfield',
name: 'firstName',
fieldLabel: 'First Name'
}, {
xtype: 'textfield',
name: 'lastName',
fieldLabel: 'Last Name'
}, {
xtype: 'textarea',
name: 'message',
width: 300,
fieldLabel: 'Message'
}],
buttons: [{
text: 'Submit',
handler: function() {
this.form.submit();
},
scope: this
}]
});
guestbookForm2.superclass.initComponent.call(this, arguments);
}
});
Ext.onReady(function() {
Ext.QuickTips.init();
var guestbookform2 = new guestbookForm2();
var guestbookform = new Ext.form.FormPanel({
api: {
submit: Guestbook.addEntry
},
fileUpload: true,
border: false,
height: 250,
bodyStyle: 'padding: 15px;',
items: [{
xtype: 'textfield',
name: 'firstName',
fieldLabel: 'First Name'
}, {
xtype: 'textfield',
name: 'lastName',
fieldLabel: 'Last Name'
},{
xtype: 'textarea',
name: 'message',
width: 300,
fieldLabel: 'Message'
}],
buttons: [{
text: 'Submit',
handler: function() {
guestbookform.getForm().submit();
}
}]
});
var panel = new Ext.Panel({
title: 'Leave a Message',
items: [
guestbookform
]
});
panel.render(document.body);
});
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Editor Grid/Writer Example</title>
<link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.1.1/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="../ext/ux/css/fileuploadfield.css" />
<style>
.item-over
{
background-color : Aqua;
}
</style>
<script type="text/javascript" src="http://extjs.cachefly.net/ext-3.1.1/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="http://extjs.cachefly.net/ext-3.1.1/ext-all.js"></script>
<!-- directProxy.rfc was registred in the web.config -->
<script type="text/javascript" src="../directProxy.ashx"></script>
<script type="text/javascript" src="Guestbook.js"></script>
<!-- Common Styles for the examples -->
<link rel="stylesheet" type="text/css" href="../../shared/examples.css" />
<link rel="stylesheet" type="text/css" href="../../shared/icons/silk.css" />
</head>
<body>
</body>
</html>
In the following example the form guestbookform created on the fly works fine, the server method is called with the form parameters.
However the extended FormPanel, when created guestbookform2 and submitted results in a normal submit to the HTML page, the Ext.Direct api is not recognised.
Does anybody know why this is not working ?
Ext.Direct.addProvider(Ext.app.REMOTING_API);
guestbookForm2 = Ext.extend(Ext.form.FormPanel, {
initComponent: function() {
Ext.apply(this, {
api: {
submit: Guestbook.addEntry
},
id: 'aricle_form',
fileUpload: true,
border: false,
height: 250,
bodyStyle: 'padding: 15px;',
items: [{
xtype: 'textfield',
name: 'firstName',
fieldLabel: 'First Name'
}, {
xtype: 'textfield',
name: 'lastName',
fieldLabel: 'Last Name'
}, {
xtype: 'textarea',
name: 'message',
width: 300,
fieldLabel: 'Message'
}],
buttons: [{
text: 'Submit',
handler: function() {
this.form.submit();
},
scope: this
}]
});
guestbookForm2.superclass.initComponent.call(this, arguments);
}
});
Ext.onReady(function() {
Ext.QuickTips.init();
var guestbookform2 = new guestbookForm2();
var guestbookform = new Ext.form.FormPanel({
api: {
submit: Guestbook.addEntry
},
fileUpload: true,
border: false,
height: 250,
bodyStyle: 'padding: 15px;',
items: [{
xtype: 'textfield',
name: 'firstName',
fieldLabel: 'First Name'
}, {
xtype: 'textfield',
name: 'lastName',
fieldLabel: 'Last Name'
},{
xtype: 'textarea',
name: 'message',
width: 300,
fieldLabel: 'Message'
}],
buttons: [{
text: 'Submit',
handler: function() {
guestbookform.getForm().submit();
}
}]
});
var panel = new Ext.Panel({
title: 'Leave a Message',
items: [
guestbookform
]
});
panel.render(document.body);
});
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Editor Grid/Writer Example</title>
<link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.1.1/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="../ext/ux/css/fileuploadfield.css" />
<style>
.item-over
{
background-color : Aqua;
}
</style>
<script type="text/javascript" src="http://extjs.cachefly.net/ext-3.1.1/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="http://extjs.cachefly.net/ext-3.1.1/ext-all.js"></script>
<!-- directProxy.rfc was registred in the web.config -->
<script type="text/javascript" src="../directProxy.ashx"></script>
<script type="text/javascript" src="Guestbook.js"></script>
<!-- Common Styles for the examples -->
<link rel="stylesheet" type="text/css" href="../../shared/examples.css" />
<link rel="stylesheet" type="text/css" href="../../shared/icons/silk.css" />
</head>
<body>
</body>
</html>