PDA

View Full Version : Swapping date format when posting a form



Niels Liisberg
11 Sep 2008, 11:11 AM
Gents;

Is there a simple way to swap a date format on a input form from lets say d/m/y so the server receives it in format Y-m-d in the form, or do I have to do that on the server ?

I have played with:



form.on('beforeaction' , function(form, action ) {
var d = form.findField('STOCKDATE');
d.format = 'Y-m-d';
});

... where STOCKDATE is of xtype:'datefield'





.. but i only get an invalid date messages on the form

:-?

Thanks

mystix
15 Sep 2008, 6:35 PM
this plugin might be of use:
http://extjs.com/forum/showthread.php?p=137095

plugging that into your FormPanel allows you to specify a getSubmitValue() method which you can then customize to your heart's content.

mjlecomte
15 Sep 2008, 6:47 PM
Also check here
http://extjs.com/learn/Ext_FAQ_Forms#Modifying_a_date_in_a_form_to_send_to_back_end

Niels Liisberg
16 Sep 2008, 7:04 AM
Super;

it works great, however I would like a more "data aware" solution build into ext ..

For now it will do;

Thanx again guys

Niels;