Jump to content

[SOLVED] INPUT BOX FOR INTEGER VALUES


ali_2kool2002

Recommended Posts

It can't be done....

 

If you have a text input element on a page and only want numbers in there you have to use javascript. That can be turned off so you shouls always validate the data in the php script accepting it.

Here is an example of the javascript you can use to remove all characters except numbers from a field when the user moves off the field. However, as ToonMariner stated you should do the same thing on the server-side as well.

 

<input type="text" onblur="this.value=this.value.replace(/\D/g,'');">

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.