Ajax date verification bug found

EricWebsite

Member
Hello,
I found a bug: on a form, when Ajax validation is switched on, any validation on a date field will cause it to change a manually entered date to today's date.
Dates entered through the date-picker will stick and be saved OK.

T reproduce:
- create a list
- create a form, set the form validation to Ajax
- create a date element, set validation to "isnotempty", or any other
- from list view, back-end or front-end, or on a form opened through a menu item, manually enter a date.
When the field looses focus the date will be changed to today's date. The database will hold the changed date.

My details: Joomla! 3.9.1, PHP 7.1.25 / cgi-fcgi. Fabrik 3.9

Hope it can be solved quickly, thanks in advance!

Eric
 
Hmmm, yeah ... it's to do with the order that events get fired. There's a 'blur' event on the date field, to take the date you entered by hand and poke it into the various places it needs to be (in the format it needs to be in) ... and there's another 'blur' event to kick off an Ajax validation ... and unfortunately the validation one is firing before the value handling one ... so the validation gets the wrong date.

Unfortunately there's no way of forcing the order that the events fire in, so I'm working on having the code that handles the Ajax call also make sure that the code that should run to set the values, is run.

Hopefully have a fix later today.

-- hugh
 
Hi Hugh,

We found another strange behavior of the date element!
For some events we also use the "Show time picker".
When we edit an existing record and use the time picker, it advances the selected time by 1 hour after the element looses focus!
And the 1 hr later time will be saved in the database.
We are on CET, with daylight saving, and the element is set to store the value as UTC.

Eric
 
Hi Hugh,

Yes indeed it works as it does in your video: using the date picker.
The problem occurs when you enter the date by typing in the field directly!
Then reverts to today for a new record, and in an existing record to the old value as soon as the field looses focus.
Eric
 
I can't replicate your issue (resetting the date)
but on ajax validation it's adding the timezone offset (I think there was a thread also but I can't find it).
@cheesegrits : Old date element, recent GitHub, date = UTC
You should do a complete GitHub update.
 
Hi, best wishes!
This problem has not been solved yet! We updated from Github, changed the element to the new JDate as well. Set "Allow typing in field" to Yes.
Still the same problem, on the front- and back-end.
Manually entering, changing or deleting a date does not work. Only through the date-picker it works.
What happens:
1) when the field was empty, as soon as it looses focus, it goes to today's date.
2) when it held a date, when the field looses focus, it goes back to the original value.
Please help!

Thanks in advance
Eric
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top