Link to home
Start Free TrialLog in
Avatar of tbsolutions
tbsolutionsFlag for Brazil

asked on

Javascript Currency Mask for Asp.Net

My page has a textbox that uses a javascript currency mask function, the mask works fine. TextBox AutoPostBack property is enabled, but the only key that calls the "PostBack" to start the "onTextChanged" event is the "Enter".  I need to call the "PostBack/onTextChanged" when the field loose it's focus (not only pressing "Enter" but for example with "Tab" or simply clicking out). I tried to remove the mask, and everything worked. I don't know if the problem is the script function or the page behavior.
 User generated image User generated image
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Remove the return false at the end of the MascaraMoeda function
Avatar of tbsolutions

ASKER

The textbox keeps responding only when you press "Enter".
Sorry, remove the return in onkeypress too
Like this :


<asp:TextBox ID="txtValorStrike" onkeypress="MascaraMoeda(this,'.',',',event)" CssClass="TextBoxCommon" runat="server" Width="134px" AutoPostBack="True" OnTextChanged="txtValorStrike_TextChanged"></asp:TextBox>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That's it! Thanks.
You're welcome! Thanks for the points!