?
avatar astridx
astridx
23 Dec 2016

Steps to reproduce the issue

Create a new field from type calendar and set in a default value, which is not possible. For example: mydefault

Expected result

The not possible default value should be ignored or I should see an error message

Actual result

The field is saved. But if i open an article for editing, the view is broken.
bildschirmfoto vom 2016-12-23 07-44-43
bildschirmfoto vom 2016-12-23 07-45-25

avatar astridx astridx - open - 23 Dec 2016
avatar joomla-cms-bot joomla-cms-bot - change - 23 Dec 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 23 Dec 2016
avatar dgt41
dgt41 - comment - 23 Dec 2016

@astridx what's the browser's console error here?
BTW text is not acceptable for the calendar, the value needs to adhere to the given format, e.g. for %Y-%m-%d an acceptable value could be 2016-01-01

avatar Bakual
Bakual - comment - 23 Dec 2016

The formfields that are used here don't check the validity of a default value. The code just assumes that the person who set the value knew what he did. Until now, that was the extension developer who set the default value. Now an admin can do the same.

Imho, it is up to the administrator to make sure the default values work.

avatar ggppdk
ggppdk - comment - 23 Dec 2016

Most fields will not break with a wrong default value
-- if a field should validate the default value, it is a thing of every field atomically,

It could be added to form field creation and show a warning
-- thus configuration can be fixed

It should never be added when the field values are viewed / rendered

  • because the warning during form field creation should have pointed into fixing the configuration
  • because you may be displaying 200 articles / records, and the validation will run 200 times ... without real need for it
avatar dgt41
dgt41 - comment - 23 Dec 2016

Most fields will not break with a wrong default value
-- if a field should validate the default value, it is a thing of every field atomically,

Actually the calendar (the js part) will default to today if the specified value is bad AFAIK
Maybe the com_fields is not utilising the new calendar yet?

avatar laoneo
laoneo - comment - 23 Dec 2016

@dgt, it just creates a calendar form field. So the new calendar should be loaded automatically, or?

avatar astridx
astridx - comment - 23 Dec 2016

Imho, it is up to the administrator to make sure the default values work.

Yes, for me it is no problem. And I am very happy with the custom fields like this.
But I think there are many administrators who do not know the syntax. And Joomla! has the problem that people say it is not user friendly.
That is why I opened this issue.

avatar Bakual
Bakual - comment - 23 Dec 2016

A wrong default value in calendar likely produces an error on server side already, way before JS got a chance to fix it :)

avatar Bakual
Bakual - comment - 23 Dec 2016

If it's is only the calendar formfield that is affected, we may add some checks to that. It's certainly as @ggppdk says that this should be done in the formfield itself if we want to do it.

avatar Bakual Bakual - change - 23 Dec 2016
Title
A default value, which is not possible, breakes article view view
[com_fields] A default value, which is not possible, breakes article view view
avatar Bakual Bakual - change - 23 Dec 2016
Title
A default value, which is not possible, breakes article view view
[com_fields] A default value, which is not possible, breakes article view view
avatar Bakual Bakual - edited - 23 Dec 2016
avatar dgt41
dgt41 - comment - 23 Dec 2016

@Bakual yup, here is an example: http://codepen.io/dgt41/pen/BQEgvp

@laoneo you can discard my previous comment, fields are extending Joomla fields so...

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 1 Feb 2017

Issue stay on latest 3.7-staging, wrong default Value breaks View.

avatar nibra nibra - change - 16 Mar 2017
Category com_fields
avatar nibra nibra - change - 16 Mar 2017
Status New Confirmed
avatar nibra nibra - change - 16 Mar 2017
Title
[com_fields] A default value, which is not possible, breakes article view view
An invalid default value breaks article view
avatar joomla-cms-bot joomla-cms-bot - edited - 16 Mar 2017
avatar dgt41
dgt41 - comment - 16 Mar 2017

@Bakual can we do something similar to http://codepen.io/dgt41/pen/BQEgvp in the php part of the date?
If value is bad => value = now ??

avatar Bakual
Bakual - comment - 16 Mar 2017

Either "now" or "empty value" would work for me, I don't care. Is it only on JS side where it breaks currently?

avatar laoneo
laoneo - comment - 1 Apr 2017

This issue can be closed as we have a pr #15032.

avatar franz-wohlkoenig franz-wohlkoenig - change - 1 Apr 2017
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2017-04-01 12:53:46
Closed_By franz-wohlkoenig
avatar joomla-cms-bot
joomla-cms-bot - comment - 1 Apr 2017
avatar joomla-cms-bot joomla-cms-bot - close - 1 Apr 2017

Add a Comment

Login with GitHub to post a comment