diff --git a/manager/assets/modext/widgets/resource/modx.panel.resource.js b/manager/assets/modext/widgets/resource/modx.panel.resource.js index 5d2f9c7d52..61aed492fc 100644 --- a/manager/assets/modext/widgets/resource/modx.panel.resource.js +++ b/manager/assets/modext/widgets/resource/modx.panel.resource.js @@ -26,7 +26,11 @@ MODx.panel.Resource = function(config) { ,fieldChange: {fn:this.onFieldChange,scope:this} ,failureSubmit: { fn: function () { - this.showErroredTab(this.errorHandlingTabs, 'modx-resource-tabs') + var uriField = this.getForm().findField('uri'); + if (uriField && !uriField.isValid()) { + this.revealUriField(); + } + this.showErroredTab(this.errorHandlingTabs, 'modx-resource-tabs'); }, scope: this } @@ -275,6 +279,31 @@ Ext.extend(MODx.panel.Resource,MODx.FormPanel,{ } } + ,revealUriField: function() { + var urio = Ext.getCmp('modx-resource-uri-override'); + var uri = Ext.getCmp('modx-resource-uri'); + if (urio && uri) { + urio.setValue(true); + uri.show(); + } + } + + ,failure: function(o) { + var errors = o && o.result && o.result.errors; + if (this.hasUriError(errors)) { + this.revealUriField(); + } + MODx.panel.Resource.superclass.failure.call(this, o); + } + + ,hasUriError: function(errors) { + if (!errors) { return false; } + if (Array.isArray(errors)) { + return errors.some(function(e) { return e && e.id === 'uri'; }); + } + return !!errors.uri; + } + // used for realtime-alias transliteration ,translitAlias: function(string) { if (!this.config.translitloading) { @@ -1002,7 +1031,6 @@ Ext.extend(MODx.panel.Resource,MODx.FormPanel,{ ,description: '[[*uri]]
'+_('resource_uri_help') ,name: 'uri' ,id: 'modx-resource-uri' - ,maxLength: 255 ,value: config.record.uri || '' ,hidden: !config.record.uri_override }]; diff --git a/manager/assets/modext/widgets/resource/modx.tree.resource.js b/manager/assets/modext/widgets/resource/modx.tree.resource.js index a1f2265859..c644a2140c 100644 --- a/manager/assets/modext/widgets/resource/modx.tree.resource.js +++ b/manager/assets/modext/widgets/resource/modx.tree.resource.js @@ -1448,7 +1448,6 @@ MODx.getQuickCreateResourceSettingsFields = function(id, parentData) { description: `[[*uri]]
${_('resource_uri_help')}`, name: 'uri', id: `modx-${id}-uri`, - maxLength: 255, anchor: '100%', value: parentData.uri || '', hidden: !parentData.uri_override