diff --git a/_locales/cy/messages.json b/_locales/cy/messages.json index 604525f..6003db3 100644 --- a/_locales/cy/messages.json +++ b/_locales/cy/messages.json @@ -58,5 +58,13 @@ "noTenantAlert": { "message": "Nodwch sefydliad mewn lleoliadau ymestyn", "description": "Alert presented if no institution has been set" + }, + "noTenantShortCodeAlert": { + "message": "Wrth ddewis Arall rhaid i chi nodi cod byr tenant", + "description": "Alert presented if Other institution is selected but no short code is provided" + }, + "noTenantRegionAlert": { + "message": "Wrth ddewis Arall rhaid i chi nodi rhanbarth", + "description": "Alert presented if Other institution is selected but no region is provided" } } diff --git a/_locales/en/messages.json b/_locales/en/messages.json index ab17d81..1d7f6bf 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -58,5 +58,13 @@ "noTenantAlert": { "message": "Please specify an institution in extension settings", "description": "Alert presented if no institution has been set" + }, + "noTenantShortCodeAlert": { + "message": "When selecting Other you must specify a tenant short code", + "description": "Alert presented if Other institution is selected but no short code is provided" + }, + "noTenantRegionAlert": { + "message": "When selecting Other you must specify a region", + "description": "Alert presented if Other institution is selected but no region is provided" } } diff --git a/js/options.js b/js/options.js index 79320a0..b8dc069 100644 --- a/js/options.js +++ b/js/options.js @@ -12,6 +12,17 @@ $(function() { if ($('#specifyTenant:selected').length > 0) { var otherTenantCode = $('#tenantCode').val(); var otherTenantRegion = $('#tenantRegion').val(); + + if (!otherTenantCode.trim()) { + $('#optionsHelp').html('
' + chromeOrBrowser().i18n.getMessage('noTenantShortCodeAlert') + '
'); + return; + } + + if (!otherTenantRegion.trim()) { + $('#optionsHelp').html('
' + chromeOrBrowser().i18n.getMessage('noTenantRegionAlert') + '
'); + return; + } + saveActiveTenantAndUpdateStatus( buildTenant(otherTenantCode, otherTenantRegion) );