Skip to content

Commit

Permalink
More form validation: isNaN [issue #38]
Browse files Browse the repository at this point in the history
  • Loading branch information
danijanos committed Dec 11, 2018
1 parent bd96f9d commit bc140d9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ function SendPurchaseRequest() {
var selectList = document.getElementById('purchaseDropdown');
var currency = selectList.options[selectList.selectedIndex].value.toUpperCase();
var amount = document.getElementById('purchaseAmount').value;
if (isNaN(amount)){
alert("A beirt osszeg nem egy szam!");
}
var resource = nagyvallalatiAPI_EndpointResources.purchase;

var data = JSON.stringify({ "Symbol": currency, "Amount": amount });
Expand Down Expand Up @@ -158,6 +161,9 @@ function SendSellRequest() {
var selectList = document.getElementById('sellDropdown');
var currency = selectList.options[selectList.selectedIndex].value.toUpperCase();
var amount = document.getElementById('sellAmount').value;
if (isNaN(amount)){
alert("A beirt osszeg nem egy szam!");
}
var resource = nagyvallalatiAPI_EndpointResources.sell;

var data = JSON.stringify({ "Symbol": currency, "Amount": amount });
Expand Down

0 comments on commit bc140d9

Please sign in to comment.