Solved

InstallShield 2009 Premier: How to create a text box validator

Posted on 2014-10-13
4
693 Views
Last Modified: 2014-10-16
Product: InstallShield 2009 Premier
Package Type: Basic MSI

I need to validate a text box entry to ensure It is not empty or contain any non-alphanumeric characters.

My question is what are the steps for adding textbox validation with InstallShield 2009?

Thanks,

rick
0
Comment
Question by:sadlermd
  • 2
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Vadim Rapp earned 500 total points
ID: 40379938
1. create custom action, for example vbscript, that will analyze the property assigned to your textbox (edit control) and set another property based on the result. For example, if the property is called MYBOX, then

value = Session.Property("MYBOX")
IsValid=True
For i = 1 To len(value)
	s = mid(value,i,1)
	Select Case s
		Case "1","2","3",(...),"A","B",(...),"Z","a","b",(...),"z"
		Case Else
		IsValid=False
	End Select
Next
if len(value)=0 then IsValid=False
If IsValid Then 
  Session.Property("TextIsValid")="1"
  Else
  Session.Property("TextIsValid")="0"
End If

Open in new window


Make the script synchronous, ignore exit code, not in any sequence.

2. Create text control near the edit control, with the text like "Invalid Input"; make it initially invisible, but specify 2 conditions, to show when TextIsValid="1" and to hide otherwise.

3. for the button "Next", create new event DoAction to run your vbscript; put it before the events that would cause the installation to proceed; for those events, specify additional condition TextIsValid="1" .
0
 

Author Comment

by:sadlermd
ID: 40382536
thanks, i will give this a try
0
 

Author Comment

by:sadlermd
ID: 40384863
This solves 99% of the problem - the issue now is how to make the "Invalid Input" message display.

Here is the sequence:

1. user enter an invalid value
2. user clicks "Next"
3. the validation occurs and prevents the user from proceeding to next page
4. the "Invalid Input" text does not appear

Here is a snippet from the log - I am validating that the name doesn't contain non-alphanumeric characters:

Action 12:17:25: MFSServerAccessInformation. Dialog created
MSI (c) (BC:30) [12:17:29:441]: PROPERTY CHANGE: Modifying MFS_NAME property. Its current value is 'NewYorkOffice'. Its new value: 'New York Office'.
MSI (c) (BC:30) [12:17:29:601]: Doing action: caVerifyAlphaNumericTextOnly
Action 12:17:29: caVerifyAlphaNumericTextOnly.
Action start 12:17:29: caVerifyAlphaNumericTextOnly.
MSI (c) (BC:A8) [12:17:29:603]: Invoking remote custom action. DLL: C:\Users\RICK~1\AppData\Local\Temp\MSIA626.tmp, Entrypoint: m1
MSI (c) (BC:04) [12:17:29:656]: PROPERTY CHANGE: Modifying ALPHA_NUMERIC_TEXT_ONLY property. Its current value is '1'. Its new value: '0'.
Action ended 12:17:29: caVerifyAlphaNumericTextOnly. Return value 1.


Note that if i click the "Back" button and then click "Next" to return to the page i'm validating, the "Invalid Input" is visible.

It seems like the Dialog Behavior "Subscriptions" page contains the answer but i'm not sure.

Thanks

rick
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 40385031
You are right, when property is set from within custom action, this does not cause the controls on the dialog to re-evaluate the conditions. They do it when a property is set by Installer itself, or when you re-display the dialog like you did.

To work around this problem, we can create fake property change: set another event for the Next button:

event: [dummy]
argument: dummy
condition: 1

Now Installer will see that some property might have changed, and will force the controls to re-evaluate the conditions, so the label will react.

Subscriptions that you mentioned would be logical choice, if only the event "some property was changed somewhere" was available to subscribe to; but it's not.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IPA - change main server? 3 148
PXE Implementation When the Motherboard BIOS Doesn't Support Ii 5 96
Sharepoint installation and configuration 4 69
ruby gem installation 2 53
Among others, I monitor the Windows Installer zone and Installer zone. I find that many of the questions could be answered much more quickly if a Windows Installer verbose log were submitted with the question.   However, I do not always have t…
I have been scripting applications way too long and can never remember how to create an ISS file.  So I decided to write this article to act as my own knowledge base for future reference, and hope you will also benefit. An ISS file is a response …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question