Summary
create a required field in a dialog for InstallShield.
Synopsis
This Knowledge Base article will show you how to add a required field to your custom Windows Installer dialog. For example, if you're looking to create an edit field that requires text before moving to the next dialog, this article will show you how you can implement this.
Discussion
There is no way to set an option that will toggle an edit field into a required text field, however with a custom action and some InstallScript we can prevent the next dialog from being advanced and display a message asking for the field to be populated.
- What you'll want to do is create a InstallScript function that calls
MsiGetProperty() on theproperty(ex TEXT) that the edit field populates. You can create an InstallScript function under Behavior and Logic->InstallScript. Then in the middle pane right click Files->New Script File. A functionMyFunction() should be created in the setup.rul. In the function you'll want to check if the edit field'sproperty(value returned byMsiGetProperty) is empty or populated and then doMsiSetProperty() on a secondproperty(ex ADVANCENEXT) that will determine whether or not the dialog should advance. - Next associate the created installscript function with a custom action. This can be done in th Custom Actions and Sequences view, right click Custom Actions in the middle pane and New InstallScript. Set the Function Name to the name of the function created in Step 1).
- Setup the message to be displayed when field is empty. Create another InstallScript function that calls the InstallScript funtion MessageBox() and associate that with another custom action.
- Navigate to the dialog with the edit field under the Dialogs view, go to its behavior. Add a condition to the NewDialog event on the Next PushButton that validates against the second Property(ex ADVANCENEXT). Add a DoAction event before the NewDialog that calls the custom action created in Step 2. Also add a DoAction to call the MessageBox custom action of Step 3 with a condition that validates against the second Property (ex ADVANCENEXT).
- You'll also want to initialize the edit field property(ex TEXT) in Property Manager to an empty value.
In essence, when the Next button is pushed it will call a custom action that checks to see if the Text field is empty and sets a property that allows/prevents advancement.
Additional Information
Here is example code for the InstallScript Custom action.
MsiGetProperty(hMSI,"TEXT",szValue,szSize);
if (szValue = "") then
SprintfBox(INFORMATION,"Enter Text","Please Enter a Value for the Text Field");
MsiSetProperty(hMSI,"ADVANCENEXT","0");
else
SprintfBox(INFORMATION,"Value Set","Value Set");
MsiSetProperty(hMSI,"ADVANCENEXT","1");
endif;Related Articles
How to create a required field in Suite 5Number of Views Rev2 - Required Fields For A Concurrent Triad License Generated Through The Product And Licensing Center 14Number of Views How to make Product Catalog Field in Request Form as Required 5Number of Views InstallAnywhere can not Create the Software Identification Tag Because the Required Fields are Missing Under Project > Sof… 10Number of Views How To: Create HotKeys in a Dialog box 5Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add additional feedback (optional)
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
|
FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513
(toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367
(toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895
2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Revenera Assistant
Case id: 00001065
Activity: Status change: 2 hours ago