Account Page refreshes on autosave/combobox Language value change

Passing the next field id to focus the next field automatically after the page
reload due to the language selection.

LEARNER-3832
This commit is contained in:
Hamza Munir
2018-09-05 16:57:35 +05:00
parent 27cf027a79
commit 97106e78b3
2 changed files with 11 additions and 2 deletions

View File

@@ -168,7 +168,8 @@
{platform_name: platformName}
),
options: fieldsData.language.options,
persistChanges: true
persistChanges: true,
focusNextID: '#u-field-select-country',
})
},
countryFieldView,
@@ -388,7 +389,12 @@
});
accountSettingsView.render();
if( $.cookie('focus_id')) {
$($.cookie('focus_id')).attr({"tabindex": 0});
$($.cookie('focus_id')).focus();
// Deleting the cookie
document.cookie = "focus_id=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/account;";
}
showAccountSettingsPage = function() {
// Record that the account settings page was viewed.
Logger.log('edx.user.settings.viewed', {

View File

@@ -143,6 +143,9 @@
this.showNotificationMessage(successMessage);
if (this.options.refreshPageOnSave) {
if ("focusNextID" in this.options) {
$.cookie('focus_id', this.options.focusNextID );
}
location.reload(true);
}