marcthepunk
Level 2

Validate ipaddress

Hello to the community.

I've been searching for days how to implement this simple task without success. I'll appreciative any help given.

I'm working with version 2010 on a basic msi project. I wish to integrate an ip address text field on a dialog box and have a control validate the ip for format.

I've used Masked edit box for character control but it doesn’t control for values outside of the 255 scope.

I've also noticed that you're unable to used the sunken=true option without the restricted border line. <###.###.###.###> creates 4 separate flat boxes which doesn’t match the style of the dialogs.

Thanks.
Labels (1)
0 Kudos
2 Replies
cbragg
Level 7

When i've done this i've tested the property using a vbscript custom acting which using regex in a vbscript. If it's invalid after the doaction then i spawn and invalid dialog which is conditioned on the property created by the script VALIDIP

Heres the script:

Option Explicit
Dim myRegExp: Set myRegExp = New RegExp
myRegExp.IgnoreCase = True
myRegExp.Global = True
myRegExp.Pattern = "^(([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+))$"
Dim myMatches: Set myMatches = myRegExp.Execute(Session.Property("MYIPADDRESSPROPERTY"))
If myMatches.Count > 0 Then
Session.Property("VALIDIP") = "True"
Else
Session.Property("VALIDIP") = "False"
End If
0 Kudos

Hi,

 

we saw you solution for ip validation

where the script should be triggered?

is it CA right?

 

thanks

0 Kudos