Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JS TypeError if image/file TV fails validation, preventing error popup from showing [Rebuild] #15282

Merged
merged 1 commit into from Oct 8, 2020

Conversation

Mark-H
Copy link
Collaborator

@Mark-H Mark-H commented Oct 7, 2020

What does it do?

Prevent JS error if an image/file tv fails validation.

Why is it needed?

On 2.8.0 saving an image/file tv that is required (allow blank = no) results in:

modx.panel.js:405 Uncaught TypeError: Cannot read property 'hidden' of undefined
    at MODx.panel.Resource.showErroredTab (modx.panel.js:405)
    at MODx.panel.Resource.fn (modx.panel.resource.js:25)
    at h.Event.fire (ext-all.js:21)
    at MODx.panel.Resource.fireEvent (ext-all.js:21)
    at MODx.toolbar.ActionButtons.handleClick (modx.component.js:298)
    at S.onClick (ext-all.js:21)
    at HTMLSpanElement.I (ext-all.js:21)

This avoids the js error, allowing the popup to be shown.

Related issue(s)/PR(s)

#15146

…reventing error popup from showing

```
modx.panel.js:405 Uncaught TypeError: Cannot read property 'hidden' of undefined
    at MODx.panel.Resource.showErroredTab (modx.panel.js:405)
    at MODx.panel.Resource.fn (modx.panel.resource.js:25)
    at h.Event.fire (ext-all.js:21)
    at MODx.panel.Resource.fireEvent (ext-all.js:21)
    at MODx.toolbar.ActionButtons.handleClick (modx.component.js:298)
    at S.onClick (ext-all.js:21)
    at HTMLSpanElement.I (ext-all.js:21)
 ```
@Mark-H Mark-H requested a review from opengeek as a code owner October 7, 2020 13:47
@cla-bot cla-bot bot added the cla-signed CLA confirmed for contributors to this PR. label Oct 7, 2020
@smg6511
Copy link
Collaborator

smg6511 commented Oct 8, 2020

Not disputing this, but I want to replicate it to get a better understanding of the case. Can you detail how you make this error happen?

@Mark-H
Copy link
Collaborator Author

Mark-H commented Oct 8, 2020

If you're not seeing it when a tv is required and uncategorized, I'll have to double-check.

@smg6511
Copy link
Collaborator

smg6511 commented Oct 8, 2020

Yeah, I've tried with a bunch of scenarios (tvs below, above, only uncategorized, categorized and uncategorized) but can't seem to get the error to pop up.

@opengeek opengeek added this to the v2.8.1 milestone Oct 8, 2020
@Mark-H
Copy link
Collaborator Author

Mark-H commented Oct 8, 2020

Okay, it looks to be specific to the image and file TV types and the categorisation isn't relevant - with an image/file TV that has allow blank disabled, the error does not popup and it does not open the right TV (sub)tab, wether that's uncategorized or something else.

Changing the TV to a text/number/date/richtext input while keeping allowBlank disabled makes it work as expected.

TVs are in the standard tab.

@Mark-H Mark-H changed the title Fix JS TypeError if TV fails validation that is in not categorized, preventing error popup from showing [Rebuild requires] Fix JS TypeError if image/file TV fails validation, preventing error popup from showing Oct 8, 2020
@Mark-H Mark-H changed the title [Rebuild requires] Fix JS TypeError if image/file TV fails validation, preventing error popup from showing Fix JS TypeError if image/file TV fails validation, preventing error popup from showing [Rebuild] Oct 8, 2020
@opengeek opengeek merged commit 96abc1a into modxcms:2.x Oct 8, 2020
@JoshuaLuckers JoshuaLuckers added the pr/port-to-3 Pull request has to be ported to 3.x. label Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed CLA confirmed for contributors to this PR. pr/port-to-3 Pull request has to be ported to 3.x.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants