Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

InstallShield 2009 Premier: How to create a text box validator

Posted on 2014-10-13
4
Medium Priority
?
784 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Vadim Rapp earned 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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 …
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

722 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