How to validate a integer and chars in a textfield?

I need to validate:

  1. A textfield which is for phone and price. How can I remove the two button at the right of the textfield? Those are to higher or lower the value. I do not need them. Also if the phone begins with 0 then it get messy and red.

  2. A textfield which is for the name. Allow only A-Z,a-z,space.

Edit* I dont know why my code doesnt appear here on stackoverflow. http://jsfiddle.net/instajsf/LbYVK/

Answers


I'm going to guess that the up/down buttons you see on the entry fields are put in by your user agent (Web browser). Under Chrome, I see nothing.

As for the second part of your question, there are many, many, many posts about how how to validate user input.

A search for "javascript alphanumeric" brought this up as my first result: RegEx for Javascript to allow only alphanumeric

If you are going to be sending this data to the server, don't forget that you must validate server side as well. Nothing that comes from the client may be trusted.


Need Your Help

Assembly problem with simple program

assembly cpu-registers

I am trying to learn assembly from scratch. I have been reading up quite a bit, but even the following simple program I found in a reference book has me stumped:

HtmlAttributes in Extension Method

c# asp.net-mvc razor extension-methods asp.net-mvc-5

I'm using MVC 5 and I'm trying to write some Bootstrap extention methods. My goal is to 'overwrite' the Html.ActionLink method with Html.BootstrapLinkButton. The BootstrapLinkButton method should