diff --git a/web/pgadmin/browser/server_groups/servers/pgagent/steps/static/js/pga_jobstep.js b/web/pgadmin/browser/server_groups/servers/pgagent/steps/static/js/pga_jobstep.js index baabda68..0fa4251a 100644 --- a/web/pgadmin/browser/server_groups/servers/pgagent/steps/static/js/pga_jobstep.js +++ b/web/pgadmin/browser/server_groups/servers/pgagent/steps/static/js/pga_jobstep.js @@ -133,6 +133,14 @@ define('pgadmin.node.pga_jobstep', [ control: 'node-list-by-name', node: 'database', cache_node: 'database', select2: {allowClear: true, placeholder: ''}, disabled: function(m) { + // clear database value if agent is configured + // to execute batch jobs or connection type is remote + if (!m.get('jstkind') || !m.get('jstconntype')) { + setTimeout(function() { + m.set({'jstdbname': ''}); + }, 100); + } + return !m.get('jstkind') || !m.get('jstconntype'); }, deps: ['jstkind', 'jstconntype'], mode: ['create', 'edit'], helpMessage: gettext('Please select the database on which the job step will run.')