You found a bug! We've classified it as
TOUCH-1204
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
-
Sencha User
Alter form data using the beforesubmit event
According to the documentation of the event beforesubmit in Ext.form.Panel , I should be able to modify the values submitted, but I can't figure out how.
Implementations may adjust submitted form values or options prior to execution.
I've tried modifying the variable values, but this has no effect.
Any help is highly appreciated.
Note: I'm basically trying to send a JSON string, so I need to encode the values using JSON.stringify.
-
Sencha User
This looks like a bug. Thanks for the report.
-
Sencha User
This is working for me, using the following block of code:
Code:
var form = Ext.Viewport.add({
xtype: 'formpanel',
items: [
{
xtype: 'textfield',
label: 'one',
name: 'name',
value: 'go'
},
{
docked: 'bottom',
xtype: 'toolbar',
items: [
{
xtype: 'button',
text: 'submit',
handler: function() {
form.submit({
method: 'POST',
url: 'test'
});
}
}
]
}
],
listeners: {
beforesubmit: function(form, values, options) {
values.test = "hello";
}
}
});
This will post: 'name=go&test=hello'
-
Sencha User
This does not seem to work in ST 2.3.1!
-
Sencha User
Any updates about this?
I'm trying to add/change/format the values of the submit just like rdougan said, but is not working.
Please help!
-
Sencha User
I'm running into the same issue. The server expects a timestamp, but the form is sending something like:
Tue Jan 01 1980 00:00:00 GMT+0100 (CET)
I'm trying:
PHP Code:
onBeforeSubmit: function (form, values, opts, evt, eOpts) {
var timestamp = Ext.Date.format(values.dateOfBirth, 'U');
values.dateOfBirth = window.parseInt(timestamp, 10);
}
to no avail. Using ST 2.3.1
Is there a workaround/override?
Last edited by bruijn88; 9 May 2014 at 11:33 PM.
Reason: ST version