Validation of edit box for to accept IP Address

Having trouble running Advanced Installer? Got a bug to report? Post it all here.

Validation of edit box for to accept IP Address

Postby Prasad » Wed May 30, 2012 4:16 pm

Hi,

I have one edit box on dialog, which accepts IP address from user during installation.
I have to give validations such that only numbers and dots can be entered by user.
As I see, edit box takes all the text values. And when I set edit box attribute integer to true then it takes only numbers.
Is it possible to add validation on edit box to take only numbers and dots?
Prasad
 
Posts: 25
Joined: Fri May 25, 2012 12:55 pm

Re: Validation of edit box for to accept IP Address

Postby mihai.petcu » Thu May 31, 2012 12:01 pm

Hello,

You can try using a masked edit control instead with the following text format:
Code: Select all
<###.###.###.###>

All the best,
Mihai
Mihai Petcu
Advanced Installer Team
http://www.advancedinstaller.com/
mihai.petcu
 
Posts: 3457
Joined: Thu Aug 05, 2010 8:01 am

Re: Validation of edit box for to accept IP Address

Postby Prasad » Thu May 31, 2012 1:49 pm

Hi,

I took masked edit control and I entered <###.###.###.###> in the "Text" field from the “Properties” pane. Then I entered random alphanumeric string FF5.234.DW2.999 in that masked edit control but still accepted alphabets also, whereas according to your suggestion it should have accepted only numbers
Prasad
 
Posts: 25
Joined: Fri May 25, 2012 12:55 pm

Re: Validation of edit box for to accept IP Address

Postby Bogdan » Thu May 31, 2012 3:08 pm

Please note that this control is not supported, thus not behaving as expected, if you have enabled Enhanced UI in your package.

Regards,
Bogdan
Bogdan Mitrache
Advanced Installer Team
http://www.advancedinstaller.com/
Bogdan
 
Posts: 2403
Joined: Tue Jul 07, 2009 7:34 am

Re: Validation of edit box for to accept IP Address

Postby landgeba » Fri Jun 01, 2012 1:49 pm

I have same requirement.
I tried with masked edit control, with disabled enhanced UI.
But edit control appearing broken in to 4 parts.
I need single control accepting only ###.###.###.###(192.168.45.169).

Can I achieve this by any way using Advanced Installer with Enabled enhanced UI?
landgeba
 
Posts: 2
Joined: Fri Jun 01, 2012 1:02 pm

Re: Validation of edit box for to accept IP Address

Postby landgeba » Mon Jun 04, 2012 2:24 pm

landgeba wrote:I have same requirement.
I tried with masked edit control, with disabled enhanced UI.
But edit control appearing broken in to 4 parts.
I need single control accepting only ###.###.###.###(192.168.45.169).

Can I achieve this by any way using Advanced Installer with Enabled enhanced UI?


Could you share inputs to apply validations to input (edit) controls?
landgeba
 
Posts: 2
Joined: Fri Jun 01, 2012 1:02 pm

Re: Validation of edit box for to accept IP Address

Postby Daniel » Tue Jun 05, 2012 4:15 pm

Hello and welcome to Advanced Installer forums,

Can I achieve this by any way using Advanced Installer with Enabled enhanced UI?

No. I'm afraid this is not possible if you are using "Enhanced User Interface".

Could you share inputs to apply validations to input (edit) controls?

The solution is to use an edit box control in which the user will input the IP. You can validate if the IP is correct by using a custom action without sequence scheduled as a published event for the next button on your custom dialog.

If the inserted IP is a valid one, then your custom action should set a property (i.e. MYPROP) to the following value "valid". Otherwise, the custom action should set MYPROP to to the following value "invalid".

After your custom action runs, if MYPROP contain the "invalid" value, then a message should be displayed using a new spawn dialog and a "SpawnDialog" published control event on the next button on your custom dialog. Please keep in mind that "SpawnDialog" control event must be scheduled as latest control event in the "Published Events" tab.

If you have any questions let me know.

All the best,
Daniel
Daniel Radu
Advanced Installer Team
http://www.advancedinstaller.com/
Daniel
 
Posts: 2067
Joined: Mon Apr 02, 2012 1:11 pm

Re: Validation of edit box for to accept IP Address

Postby raju » Sun Jun 10, 2012 5:51 am

Thank you for this information.

I have added a VB script that does validation of IP address and it works fine.

But I am not able to achieve second part, i.e. if property value is "Invalid", then show a message using Spawn Dialog on published event of Next.
Can you please share detailed steps to implement this, to have 'OK' message box.

I tried-
a. Creating new UI custom action "Error Message" but this takes me to finish dialog, and I want to be on same dialog.
b. Adding predefined custom action "Message Box", but this gave me error during installation "There is a problem with windows installer package.A dll required for this install to complete could not be run. please contact support."
c. Creating script Inline with VB message box (MsgBox), but this will not have application titile and icons, (I need message, same as cancel dialog.)

I guess solution suggested by you is the only way, but I don't know how to get it done.
please share detailed steps.
raju
 
Posts: 5
Joined: Sat Jun 02, 2012 3:42 am

Re: Validation of edit box for to accept IP Address

Postby Daniel » Mon Jun 11, 2012 9:45 am

Hello,

But I am not able to achieve second part, i.e. if property value is "Invalid", then show a message using Spawn Dialog on published event of Next.
Can you please share detailed steps to implement this, to have 'OK' message box.

In order to achieve this you can proceed as follows:
- In "Dialogs" page go to dialog which contain the IP edit box. Here select the "Next >" button.
- Select the "Published Events" tab and add a new published event:
    Name: SpawnDialog
    Argument: <NewDialog>
    Condition: MYPROP = "invalid"
- Schedule "SpawnDialog" control event as last control event in the "Published Events" tab.
- Customize the spawn dialog with desired message.

I've attached a sample project which implements this part of scenario, on the "NewDialog" from the "First Time Install" dialogs tree.
sample.aip
(14.12 KiB) Downloaded 44 times

All the best,
Daniel
Daniel Radu
Advanced Installer Team
http://www.advancedinstaller.com/
Daniel
 
Posts: 2067
Joined: Mon Apr 02, 2012 1:11 pm


Return to Common Problems

Who is online

Users browsing this forum: Google [Bot] and 4 guests