PDA

View Full Version : [SOLVED] dateField formatting problem



catacaustic
8 Aug 2007, 9:03 PM
I've got some dateField areas on one of my forms to allow so that I can read in dates. The problem that I'm facing is that I need to interact with a back-end system that reads dates as the "Unix" style of "YYYY-MM-DD" and my customer needs to see the dates in the format "d/m/YYYY" when they are entered into the dateField area.

I know that I can set the format to be the correct one as far as the display goes, but how do I get the format correct when I'm submitting the dates to the remote script that needs them in a different format? I've looked and can't see anything that can help me on this one.

catacaustic
9 Aug 2007, 2:04 PM
Is there no way to do this? I thought there'd have to be something out there that'd work? :((

wolverine4277
9 Aug 2007, 2:33 PM
Maybe...


form.submit(
{
failure: function() {...},
params: {
...
dateWithFormat: form.findField('datefield').getValue().format('Y/m/d'),
...
},
success: function() {...}
url: '...'
}
);


where 'datafield' is the id or name of the Ext.form.DateField in the form and dateWithFormat is the parameter received by the script in the server side...

catacaustic
9 Aug 2007, 3:28 PM
Wolverine... You're a complete legend! Works perfectly. Thanks for helping out.