Change event seems not to happen with datePicker
Change event seems not to happen with datePicker
I have three handlers for editor field changes. One is for a select element, one for a textarea, and one for a datePicker. The change event for the select element hits when an option is selected. The change event for the textarea hits when the field loses focus. The change event for the datePicker never occurs, not when the date is selected, nor when the field loses focus. Is there some other way to detect this event that I'm not thinking of?
I have placed these handlers in the editor open handler as shown here:
// This code figures out whether any of these fields are changed in order to alert people via an email...
taskEditor.on('open', function(e,mode,action) {
changedFields = ''; // We need to track this during an edit
// other code...
taskEditor.field('status').input().on('change', function(e, d) {
if (d && d.editor) {
return;
}
if (changedFields.indexOf('status') === -1) {
changedFields = changedFields + ' status ';
}
} );
taskEditor.field('duedate').input().on('change', function(e, d) {
if (d && d.editor) {
return;
}
if (changedFields.indexOf('duedate') === -1) {
changedFields = changedFields + ' duedate ';
}
} );
taskEditor.field('scope').input().on('change', function(e, d) {
if (d && d.editor) {
return;
}
if (changedFields.indexOf('scope') === -1) {
changedFields = changedFields + ' scope ';
}
} );
The editor definitions for these fields are as follows:
// Other definitions
{
"label": "Status: ",
"name": "status",
"type": "select",
"def": "unseen",
"placeholder": "Choose",
"options": [
"unseen",
"in queue",
"in progress",
"awaiting award",
"on hold",
"pending approval",
"closed",
"lost"
]
},
{
"label": "Date Due: ",
"name": "duedate",
"type": "date",
"placeholder": "Choose Due Date",
"dateFormat": $.datepicker.ISO_8601
},
{
"label": "Scope of Work: ",
"name": "scope",
"placeholder": "Enter Scope of Work",
"type": "textarea"
},
// Other definitions
Is there some other event that is required for the dataPicker? Is there something else wrong with what I'm doing?
Thanks,
Tom
This question has an accepted answers - jump to answer
Answers
Hi @TomBajzek ,
There was a bug that would have caused this, but it was fixed in 1.9.2 - see here.
Could you look at that, please, and see if it helps. If it's still not working for you, please can you update my example, or link to your page, so that we can see the problem.
Cheers,
Colin
Hi Colin,
I'm running Editor v1.9.2. This page is private. I'll send you login credentials so you can examine it.
Thanks,
Tom
Colin,
I'm running Editor v1.9.2. However, I think your example enabled me to fix my problem: your example uses 'start_date' with a type of datetime, whereas my 'duedate' had a type of date. When I changed 'duedate' to have type datetime it worked.
I also noted that when I changed the type of 'start_date' to date in your example, it no longer delivered a datePicker when I clicked that input field.
I think I don't need you to login to look at my case now.
Thanks for your help with this,
Tom