Abdul-Rahman
Posts: 17
Joined: Thu Aug 02, 2018 7:30 am

OnChangedText custom action

Mon Aug 06, 2018 10:19 am

Hello,
As I stated in another post ,I am making a setup to install a webapplication ,and the input from the user should be the site's name ,its port,and the physical path, and I want to disable the next button till the input in the edit boxes meets specific conditions like the path being actually there and the site's name not having {#,$,!,@,%,),(,*} for example and the port number must be less than 6999 ,if this was on a windows forms app I would have used the OnChangedText event which makes validation smooth and easy ,I know I have to use a custom action ,I know how to make one and use it when a button is pressed but not on an edit box control ,any help is appreciated .
thanks,
Abdul.

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: OnChangedText custom action

Mon Aug 06, 2018 12:22 pm

Hello Abdul,

Unfortunately, we do not have support to control a button state based on what the user dynamically inputs.

As a workaround for this, you can store validation result of your custom action in a property and then use that property to conditionally display a child dialog, where you can display a warning to the user (e.g. wrong input format).

For more information about how you can set a property using a custom action, you can check our "How to set an installer property using custom actions" article.

In order to achieve this, you can go to Dialogs page --> click on the Next button --> under "Published Events" tab add an event with the following:

-Event: Execute Custom Action
-Argument: The name of your custom action
-Condition: Leave it unchanged.

Under the same tab ("Published Events"), add another event with the following:

-Event: Display a specific child dialog
-Argument: SpawnDialog
-Condition: NOT RETURNED_PROP
where RETURNED_PROP is the property where you store the return value of your custom action.

The Display a specific child dialog event must be added as the last event in the "Published Events" list.

This way, the child dialog will be displayed as long as the NOT RETURNED_PROP condition is false.

Hope this helps!

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Abdul-Rahman
Posts: 17
Joined: Thu Aug 02, 2018 7:30 am

Re: OnChangedText custom action

Mon Aug 06, 2018 1:58 pm

Hi,
Thank you for responding ,but I saw this feature used in VLC's setup where the install button is disabled until you write a valid path of which volume has enough space to install your application ,the UI looks similar to the UI provided by Advanced Installer ,so are you sure there is no way at all to disable these buttons until a specific condition is met ?

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: OnChangedText custom action

Mon Aug 06, 2018 2:49 pm

Hello Abdul,

I may have misunderstood what you wanted to achieve here.

It is, indeed, possible to have a button disabled until a condition is met, but it is not possible to have a custom action validation result as a condition for a "Control Condition".

In order to do so, you can go to "Dialogs" page, select your custom dialog --> click on the "Next" button --> on the right side, under "Properties" set the "Enabled" attribute to "False". Now, under "Control Conditions" tab create a new control condition with your desired condition and action.

For example, if you want to enable the "Next" button when the port number is lower than 6999, you can have a condition as it follows:

Code: Select all

PORT_PROPERTY < "6999"
and the Action should be "Enable". Now you also have to create a control condition which will disable your button in case the user inputs a port number higher than "6999". To do so, create a new control condition with the following:

-Condition: PORT_PROPERTY >= "6999"
-Action: Disable

Please keep that this is not possible using a custom action validation result as a condition. If you want to use a custom action validation result as a condition, you can follow the steps I have earlier described in my first post.

Hope this helps!

Regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”