modxcms / revolution

MODX Revolution - Content Management Framework
https://modx.com/
GNU General Public License v2.0
1.36k stars 529 forks source link

Empty date TVs can be saved even if "allow blank" is set to false #12302

Closed pepebe closed 5 years ago

pepebe commented 9 years ago

Just created a date tv on a virgin modx install (revo2.2.3) on modxcloud.

If I set "allow blank" for a date TV to "No", it is possible to save the resource even though date and time fields are empty. Tabbing to the next TV is also possible without triggering an error.

Any invalid value entered into the datefield (foo) triggers an error.

On the other hand If I create a text TV and set "allow blank" to "No" and leave the field empty, then I'm prevented from saving the resource and I get an error message:

bildschirmfoto 2015-01-27 um 15 47 13

This is also caused moving the focus away from the text TV.

I've checked date.tpl, but I can't see anything unusual:

revolution/manager/templates/default/element/tv/renders/input/date.tpl

I can verify this behaviour in the latest versions of FF and Chrome, so I don't think this is a browser problem.

Cheers,

pepebe

whitebyte commented 9 years ago

I think this issue is related to #7873

pepebe commented 9 years ago

Thanks for mentioning this. I'm not sure if this is really related. As far as I understand the problem, the error message is not dependent on a resource being saved or not, because the js validation kicks in as soon as you move away from the date TV. Nevertheless, I'll do some more test. Can't hurt :).

wshawn commented 9 years ago

This is not a bug as presented.

The allow blank functionality is essentially an !empty() check. Bad data or not is still data.

You may want to see if you have set a default value or if the widget show has a default value.

travisbotello commented 5 years ago

Still huge problem in 2.7.0. Resources with empty date TVs can be saved without any error/warning although allowBlank is set to false.