View Full Version : Force User to enter Product key

11-01-2005, 10:16 AM
I'm a brand new user of Installshield Devstudio version 9.0 service pack 1.

The person that worked at my new company before me created a setup file, and one of the things he did was a screen (custom dialog) that asks the user for a CD key.

It looks like he never got this to work, as the setup continues even though an unvalid CD key is entered.

He's got a next button on the screen, in the DoAction event for the next button, the argument is "TestCD" with a condition of "1", (which I understand means do always)

the TestCD is then defined as a custom action with script text similar to this:

if "code in here that validates what the user entered" then

if "input validation check" then
if "key validation check" then
'key is invalid
msgBox("Please enter a valid CD Key... Click back to enter the correct information.")
end if
msgBox("Please enter a valid CD Key... Click back to enter the correct information.")
end if

The Newdialog event has as it's argument the next form that must be displayed

and this is the condition


Can anyone perhaps tell me why the process continues whether the user enters a valid key or not?

11-04-2005, 01:26 AM
please, even a tip on how to proceed will help!

11-08-2005, 07:52 AM
I still haven't had any help regarding this.....

Ofer Rivlin
11-08-2005, 11:07 AM
Maybe try to post the code...

11-09-2005, 10:06 AM
the code is in the post at the top, with the validation parts removed...

11-09-2005, 10:50 AM
I am assuming that this is a basic MSI installation, correct? I am still new to MSI installations and learning things - but this is what I would try first.

The way I would handle this is to put a condition on the Next button that calls a custom action that executes and sets a property value (e.g., VALIDKEY).

In your dialog editor, select behavior for this dialog. Select the Next button from the list, and then Select Conditions from the box to the right (at the bottom there are three options, Events, Subscriptions, Conditions). Next in the Events for this next button, I would have it spawn the same dialog again if the value of VALIDKEY is false.

This is just an idea, I am not sure if it will work exactly, but I am sure the process is very close to what I have outlined above.

Good luck.

11-11-2005, 08:50 AM
I'll try this and see if it works....

11-11-2005, 08:04 PM
If there's a bug in the code that sets those properties, showing your pseudo-code won't really help.

It doesn't seem right to me that the TestCd call has a condition of 1 either because it will be called every time, even after the first call says it's ok! Perhaps that's ok, but it's unnecessary and might be interfering in some way.

That serial number validation code should just set a property called SERIALNUMOK to 1 if it's valid, TestCd gets called if SERIALNUMOK<>1, and NewDialog gets called if SERIALNUMOK=1, unless I'm missing something here.