Editor field - type: 'datetime
Editor field - type: 'datetime
menashe
Posts: 196Questions: 43Answers: 2
I have two date fields--start and end--on my Editor form. As I often "back enter" data several months old, I would like the END date to default to the same month that I enter for the Start date.
How can I do this?
{
label: "Start:",
name: 'prices.sale_start',
type: 'datetime',
// def: function() {
// return new Date();
// },
displayFormat: 'MM/DD/YYYY',
wireFormat: 'YYYY-MM-DD',
keyInput: true,
opts: {
firstDay: 0
}
},
{
label: "End:",
name: 'prices.sale_end',
type: 'datetime',
// def: function() {
// return new Date();
// },
displayFormat: 'MM/DD/YYYY',
wireFormat: 'YYYY-MM-DD',
keyInput: true,
opts: {
firstDay: 0
}
},
Answers
You could use the
dependent()
method. That will trigger a callback function when yoursale_end
field is set. You could add a check to see if there is a value insale_start
before setting the value.Allan
Thank you!
Almost there, but I cannot figure out how to 'set' a date field??
I wish I could withdraw the question!
No worries - good to hear you've got it working!
Allan