July 7, 2008
Limiting text input to characters and digits
By Martyn in Programming | 0 comments
To remove stuff such as punction and spaces (or anything you want) from a text box before sending to the server for validation you can use code like this, first the HTML:-
<input
name="name"
onblur="this.value = entrycheck(this.value)"
type="text"
size="20">
And then the following Javascript will remove invalid characters when the user moves to another field:-
<script type="text/javascript">
function namecheck(theInput) [...]
email this | tag this | digg this | trackback | comment RSS feed