i have just built a form with two values, one is a period of time and the other is the name of a client. Now i wanted to change the textfields that they are made by with a datefield and a dropdown menu. The dropdown menu is made but for the field "period" i have some issues. That is the page in the manual to build a datefield. The problem is, the form field takes two dates in a single string, it is called "period". But the datefield as they are made are each one a single field, with a single id to each one in the form, so i won't have the field i was searching for but two divided field. the code is below:
items: [{
xtype: 'datefield',
anchor: '100%',
fieldLabel: 'From',
name: 'from_date',
maxValue: new Date() // limited to the current date or prior
}, {
xtype: 'datefield',
anchor: '100%',
fieldLabel: 'To',
name: 'to_date',
value: new Date() // defaults to today
}],
How can i combine the two dates in a single field for the form to be processed by? Is there an hack or a workaround? Thank you.
Update
ok i've set an hidden field with the "period" id. The value of it should be a combination of the values of the two datefields. The problem is i don't know how to get the value of the datefield inside an other object. The code is the following (to make it work you have to take away the line "value:" in the "period" field):
{
xtype: 'datefield',
fieldLabel: 'Start date',
format: 'Ymd',
//altFormats: 'Ymd',
listeners: {
'change': function(me) {
alert(me.getSubmitValue());
}
}},
{
xtype: 'datefield',
fieldLabel: 'End date',
format: 'Ymd',
//altFormats: 'm/d/Y',
listeners: {
'change': function(me) {
alert(me.getSubmitValue());
}
}},
{
xtype: 'textfield',
hidden:true,
fieldLabel: 'Period',
id: 'period'
value:
},
{
xtype: 'textfield',
name: 'client',
fieldLabel: 'Client',
id: 'client'
}
Exactly how do i combine the two values? Thanks