Validating an I.P. entry

barretc

Registered User.
Local time
Today, 12:06
Joined
Jul 14, 2006
Messages
14
Hey,

I've been looking at this website (http://learning.north.londonmet.ac.uk/ib212/week7/validation.htm) and i'm trying to find an input mask that lets a user enter in an I.P. address like the IP settings in Network Connection > Properties > TCP/IP > Properties.

E.g. a user enters 19216802. I want this converted to 192.168.0.2 without the user having to enter any '.'

So far this is the closest i've gotten to validating the field
0##.0##.0##.0## whereas 0 means something has to be entered and the # are optional.

Thanks,

Barret
 
my recommendation is to just do it through code, if even that, becuase it really is impossible to judge straight of. for example:

if the user entered the number 19216810111

is that supposed to be IP 192.168.101.11 or 192.168.10.111, there is no way to tell.

my advice is to put three text boxes, when they reach a length of 3, move to the next one, and on either a . input or enter or tab or arrow, move to the next one, like the ip address, subnet mask, dns server inputs on the network configurations of windows.
 
Thanks, and to clarify, i'd be using 4 text boxes instead of 3 right?
 
hah yea, sorry.

also you could be a little more creative and do things like, if the first character is a 3 or higher, after two digits move to the next field since the highest IP can only be 255, or other things like that, but yes, 4 fields, lol.
 

Users who are viewing this thread

Back
Top Bottom