Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #10944 from lissyx/bug892908
Browse files Browse the repository at this point in the history
Bug 892908 - Prevent onsubmit from reloading system app from STK
  • Loading branch information
rvandermeulen committed Jul 22, 2013
2 parents 760884d + e4cb31e commit fa6a7d2
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions apps/system/js/icc.js
Expand Up @@ -12,6 +12,7 @@ var icc = {
init: function icc_init() {
this._icc = this.getICC();
this.hideViews();
this.protectForms();
this.getIccInfo();
var self = this;
this.clearMenuCache(function() {
Expand Down Expand Up @@ -129,6 +130,36 @@ var icc = {
});
},

/**
* Protect forms from reloading system app
*/
protectForms: function() {
var protect = function(event) {
if (!event) {
return;
}

event.preventDefault();
};

// Prevents from reloading the system app when
// the user taps on the Enter key
var iccView = document.getElementById('icc-view');
if (!iccView) {
return;
}

var forms = iccView.getElementsByTagName('form');
if (!forms) {
return;
}

for (var i = 0; i < forms.length; i++) {
var form = forms[i];
form.onsubmit = protect;
}
},

/******************************************
* ICC Helper methods
******************************************/
Expand Down

0 comments on commit fa6a7d2

Please sign in to comment.