Prasad
Posts: 25
Joined: Fri May 25, 2012 12:55 pm

Validation of path given in Path Edit control of FolderDlg

Hi,

I have issue in validating the installation path given in Path Edit control of FolderDlg
As per our requirement, during the setup user should only enter C: or D: etc.(i.e. drive name followed by colon) in Path Edit control of FolderDlg (Browse button should not be available)

So inside the Path Edit control we want to put some validations. as follows

1) If User enters some drive name name only (e.g C) or some drive name followed by colon and backsplash (e.g. C:\) and "Next" button on FolderDlg is clicked, then error message should be displayed as "Please enter drive name followed by colon"

2) If user enters some drive name that is not available on computer, an Error Message/Dialog should appear when "Next" button on FolderDlg is clicked.
e.g. If Computer has only C and D drives but when user enters E: in Path Edit, when "Next" is clicked, error message should be displayed "Unrecognized Drive, please try again."

How to validate above two conditions ?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Validation of path given in Path Edit control of FolderD

Hello,

In order to obtain your scenario you could use a custom action which will validate or not the related path.

Also, here is an easier approach that you can try to implement in order to achieve what you want:
- From "FolderDlg" dialog remove the "Browse..." button and the corresponding path edit control.
- Add a combo box (i.e DRIVE) control which will contain drive path installation. From "Properties" right pane set the "Combo List" attribute to "True".
- Populate the combo box with desired drive name. In example you can add the following two items by double clicking the combo box control:
  • Text: C:
    Value: C:

    Text: D:
    Value: D:
- Now set the default combo box value (double click on combo box control, select the desired item and from its context menu choose "Selected" option).
- Add an edit box (i.e. FOLDER) control which will contain the folder path installation.
- On the next button add, as first control event in the "Published Events" tab, the following "SetProperty" published control event:
  • Name: [APPDIR]
    Argument: [DRIVE]\[FOLDER]
    Condition: AI_INSTALL
- Build and run your project.

If you have any questions let me know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”