PDA

View Full Version : Date Field problem



mihaip007
13 May 2010, 5:13 AM
Hi...!

I just wanted to know if it is possible to place a default date when running the application for a date field. I mean I would like to show today's date already entered in the box.

I tried to use "showToday" config option but it does nothing.

Can someone suggest something on this?
Thanks a million...

mihaip007
15 May 2010, 7:24 AM
No One???

jarrednicholls
15 May 2010, 11:57 AM
The "showToday" option is the correct configuration option you should use. We will make a note to visually update the field's contents when this is chosen in a future release. Thanks.

mihaip007
16 May 2010, 1:12 AM
Hi...! Thank you for the reply :) So I take it that it does not work yet.

But how can I make it work in the meanwhile? I am not talking about Previewing, but about when exporting.
Thanks...
Mihai

jarrednicholls
18 May 2010, 5:00 AM
Sorry, I misunderstood. Setting the field to be a default value that is dynamic can be done in your implementation .js file within the initComponent function, so it will show in the text field. The "showToday" option is to turn on/off the Today button that appears at the bottom of the calendar pop-up.

e.g.:

Exported Form UI File .ui.js


MyFormUi = Ext.extend(Ext.form.FormPanel, {
title: 'My Form',
labelWidth: 100,
labelAlign: 'left',
layout: 'form',
width: 400,
height: 250,
padding: 10,
initComponent: function() {
this.items = [
{
ref: 'date',
xtype: 'datefield',
fieldLabel: 'Label',
anchor: '100%',
showToday: false
}
];
MyFormUi.superclass.initComponent.call(this);
}
});


Exported Form Implementation File .js


MyForm = Ext.extend(MyFormUi, {
initComponent: function() {
MyForm.superclass.initComponent.call(this);

this.date.setValue(new Date().format('m-d-Y'));
}
});

mihaip007
18 May 2010, 5:59 AM
oh...cool! Sorry I just realized I need to brush up on my help file reading hehehehe! You know, perhaps having a hint pop-up over the config options in the designer would be an idea! :)

Mihai

jarrednicholls
18 May 2010, 7:37 AM
Context sensitive help (links to documentation) is coming in a near future release. We agree! :-)