From 0379dba2b3eb7c45ce74e42366b3b6bcf5b52cd2 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Mon, 25 Sep 2017 19:42:01 +0200 Subject: [PATCH] Debugging JS events --- .../v5/Financial/CurrencyTextBox.ascx | 45 ++++++++++--------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/Site/Controls/v5/Financial/CurrencyTextBox.ascx b/Site/Controls/v5/Financial/CurrencyTextBox.ascx index 2711aec4..09401e17 100644 --- a/Site/Controls/v5/Financial/CurrencyTextBox.ascx +++ b/Site/Controls/v5/Financial/CurrencyTextBox.ascx @@ -30,36 +30,39 @@ $(document).ready(function () { - $('#<%=this.ClientID%>_TextInput').blur(function () { + alertify.success("doc.ready - <%=this.ClientID%>"); - var currencyText = $('#<%=this.ClientID%>_TextInput').val(); + $('#<%=this.ClientID%>_TextInput').blur(function () { - var jsonData = {}; - jsonData.input = currencyText; + var currencyText = $('#<%=this.ClientID%>_TextInput').val(); + alertify.success("blur - <%=this.ClientID%> - " + currencyText); - if (currencyText.trim().indexOf(' ') >= 0) { - // the text contains at least one space, so try to interpret it and convert it to presentation currency + var jsonData = {}; + jsonData.input = currencyText; - SwarmopsJS.ajaxCall('/Automation/FinancialFunctions.aspx/InterpretCurrency', + if (currencyText.trim().indexOf(' ') >= 0) { + // the text contains at least one space, so try to interpret it and convert it to presentation currency + + SwarmopsJS.ajaxCall('/Automation/FinancialFunctions.aspx/InterpretCurrency', + jsonData, + function(data) { + if (data.Success) { + alert("PresentationAmount:" + data.DisplayAmount + "\r\nUsed Currency:" + data.CurrencyCode + "\r\nEntered Amount:" + data.EnteredAmount); + } + }); + } else { + // the text does NOT contain at least one space, so we should format it for presentation currency + $('#<%=this.ClientID%>_TextInput').blur(function() { + SwarmopsJS.ajaxCall('/Automation/Formatting.aspx/FormatCurrencyString', jsonData, function(data) { if (data.Success) { - alert("PresentationAmount:" + data.DisplayAmount + "\r\nUsed Currency:" + data.CurrencyCode + "\r\nEntered Amount:" + data.EnteredAmount); + $('#<%=this.ClientID%>_TextInput').val(data.NewValue); } }); - } else { - // the text does NOT contain at least one space, so we should format it for presentation currency - $('#<%=this.ClientID%>_TextInput').blur(function() { - SwarmopsJS.ajaxCall('/Automation/Formatting.aspx/FormatCurrencyString', - jsonData, - function(data) { - if (data.Success) { - $('#<%=this.ClientID%>_TextInput').val(data.NewValue); - } - }); - }); - } - }); + }); + } + }); });