Posted on: 10/9/2014 5:30:06 PM | Views : 360

Hi there,

I'm hoping someone can either advise me of best practice on what i'm looking to achieve or highlight the flaws in my below code. I am looking to limit the entry into a textbox. Not only do I want to limit the keys/characters that can be entered in the field but also limit the amount of hyphens that can be entered (to max of 4). I have managed to do this by creating a variable that increases or decreases if a - is entered or deleted. This works ok on ie and chrome but on firefox it doesn't work as firefox is deleting two characters per backspace press. Also the function does not work at all on android mobile. What I have so far is -

asp page <asp:TextBox ID="FirstName" runat="server" Width="50%" Height ="15px" onkeydown ="return IsFirstName(event);" ondrop="return false;" onpaste="return false;" MaxLength="30"></asp:TextB ...

Go to the complete details ...