Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions html/js/tree/Payoff.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ GTE.TREE = (function(parentModule) {
var text = this.getCleanedText();
if (text === "") {
window.alert("Payoff should not be empty.");
} else {
thisPayoff.changeText(text);
}
thisPayoff.changeText(text);
});
};

Expand All @@ -50,6 +49,8 @@ GTE.TREE = (function(parentModule) {
* @param {String} text New payoff's text
*/
Payoff.prototype.changeText = function(text) {
//Check if it's empty or not
if(text !== "") {
// Remove leading 0
var value = parseFloat(text, 10);
// Check if it's a fraction
Expand Down Expand Up @@ -78,6 +79,10 @@ GTE.TREE = (function(parentModule) {
// In order to get the previous text back, change text to current this.text
this.changeText(this.text);
}
} else {
//If it's empty, set its value to the last stored value
this.editable.setText(this.text);
}
return this.value;
};

Expand Down