1- make sure you have more than two category for articles(com_content)
2- make sure you have at least a field for articles with context: com_content.article in com_fields
3- change back-end language to Persian(fa-IR).
4- go to Content > Articles. in Persian language the path is: محتوا > مطالب
5- edit an article and change category field value to another one.
6- after change category field value you see an error: DateTime::__construct(): Failed to parse time string (۱۳۹۶-۰۳-۰۶ ۰۳:۳۶:۰۲) at position 0 (�): Unexpected character
dont show any error and fully reload page after ajax call
after change category field value you see an error: DateTime::__construct(): Failed to parse time string (۱۳۹۶-۰۳-۰۶ ۰۳:۳۶:۰۲) at position 0 (�): Unexpected character
Joomla 3.7.x
PHP 5.6, 7.0, 7.1
I resolve this problem by editing this file:
/media/system/js/fields/calendar-locales/fa-ir.js
and comment line 19 : //localLangNumbers: ["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"]
Priority | Urgent | ⇒ | Medium |
Status | New | ⇒ | Discussion |
Anyone making this PR?
when i use this lines i get JavaScript error because (element) variable used in other lines. so i change the lines to this for resolve problem:
var elements = document.querySelectorAll(".field-calendar");
for (var i = 0; i < elements.length; i++) {
var calendarfield = elements[i],
instance = calendarfield._joomlaCalendar;
if (instance) {
instance.setAltValue();
}
}
@farzadtaheri yup, that was what I was suggesting
I can confirm, solution working.
I added code after 345 line, but with little change:
var elements = document.querySelectorAll('.field-calendar');
for (var i = 0; i < elements.length; i++) {
var calendarfield = elements[i],
instance = calendarfield._joomlaCalendar;
if (instance) {
instance.setAltValue();
}
}
can one of you Guys wrote the PR?
I did PR - please look is all OK
I am just pasting here my comments on @ViscountVic PR (which needs to be against Joomla's repo):
I would like to suggest a more decoupled snippet here (right now we are forcing calendar code into Fields and we actually fixing partially the problem, can still be a bug for other javascript dependant fields)
So here is my suggestion:
element.form.submit();
with
var button = document.createElement('input');
button.style.display = 'none';
button.type = 'submit';
element.form.appendChild(button).click();
Now a proper submit event is bubbled and the calendar (or any script that needs to do anything before submitting a form) will process the data correctly.
PS Sorry for not suggesting this in the first place but I wasn't sure that this was the actual problem. By the way I tested the code and is working fine
New solution isn't working. I see animated icon without any result.
Please restore back previous solution.
@ViscountVic what exactly is not working?
@dgt41 , hi, i think we can do this with more simple change,
i replace the line
element.form.submit();
with
Joomla.submitform('field.storeform', element.form);
and everything is work.
amazing!!
with this change no need to add this lines even!
var elements = document.querySelectorAll('.field-calendar');
for (var i = 0; i < elements.length; i++) {
var calendarfield = elements[i],
instance = calendarfield._joomlaCalendar;
if (instance) {
instance.setAltValue();
}
}
so for resolve main issue we just need change one line only (348) and nothing else.
@farzadtaheri if Joomla.submitform() works then that's a better solution!
@farzadtaheri
Please make a PR vs staging so we can test and get this in for 3.7.3
Add the link to the PR here. Thanks.
Was this resolved?
Status | Discussion | ⇒ | Information Required |
@brianteeman not yet, the problem change but not resolved! please check new PR #17859.
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-09-17 10:59:42 |
Closed_By | ⇒ | franz-wohlkoenig |
Closed_By | franz-wohlkoenig | ⇒ | joomla-cms-bot |
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/16628
closed as having Pull Request #17859
@farzadtaheri commenting out the localisation string for numbers is not the right approach. The correct solution here will be to add this code:
In the fields category change event