I have a texbox that is like this:
<input type="text" size="30" name="form[id]" id="form_id">
I need a JavaScript function that will validate:
- No Spaces allowed.
- Only numbers, letters, dashes(-) and underscores(_) allowed and no other special character allowed.
- Shouldn’t be empty
On Submit when the user’s input is violating a validation. An alert message should be displayed.
Here is the javascript
You need to subscribe the onclientclick event of the textbox.
Hope it helps