Page 1 of 1

Dialog - how to stop user clicking Next if invalid serial no

Posted: Wed Jun 20, 2007 6:35 pm
by get101
In a dialog form, I added a new edit control for the user to enter a serial number.

The Next button should only be able to be clicked when a valid serial number is entered.

So I created these rules:

Code: Select all

IF (edtSerial.Text = "BB9132") THEN Next.Enabled := True
IF (edtSerial.Text = "TT7345") THEN Next.Enabled := True
etc (20 lines in all)


The Enabled property of the Next button was set to False.

When I ran the Test dialog the Enabled button never turned to Enabled.

Am I doing this correctly?

Posted: Wed Jun 20, 2007 6:43 pm
by Edhy
Hi,

I am not an expert in IA yet, so I don't really know what may be wrong in your dialog, but in my IA learning journey, I found a sample script named "Serial Number Validador" which is very neat and I am sure in your case this script may give you some ideas for your situation or better yet you can adopt this script in your installation since this one does not need for you to have the pre-define serial numbers in your script at all.

Good luck!

Posted: Wed Jun 20, 2007 7:35 pm
by get101
Thanks for your tip regarding the Serial Number sample. That prompted me to take a look at all the samples which are interesting. Unfortunately I did not find a solution to my problem.

The samples all have very simple validations along the lines of

Code: Select all

If A is True THEN Next.Enabled := True
If A is False THEN Next.Enabled := False


What I need to know is how to handle a list, like this:

Code: Select all

If A is True THEN Next.Enabled := True
If B is True THEN Next.Enabled := True
If C is True THEN Next.Enabled := True

ELSE
THEN Next.Enabled := False


How can I add the lines in bold above to the code?
Is there an ELSE operator available? Also, is there an AND operator available?

Any suggestions on how to check that a serial number entered is equal to one of the 20 allowed will be appreciated.

Posted: Thu Jun 21, 2007 2:34 am
by jls
Try to add something like this as the first line in the Object Rules

Code: Select all

If Something THEN Next.Enabled := False


Jørgen Storlie

Posted: Thu Jun 21, 2007 3:28 am
by Ira Rainey
I came across a similar problem. I have an installation code which is a sixteen character hex value. Whilst I could check that somebody had typed the correct length of characters there was no way to ensure that only hex characters where entered, just alphanumerics.

So my solution was to add another dialog screen which tells the user that the code is being validated then shell to a console app which validates the string entered. The result of which being captured and the installer allowed to carry on or gets sent back with a warning.

Posted: Fri Jun 22, 2007 12:38 am
by get101
jls wrote:Try to add something like this as the first line in the Object Rules

Code: Select all

If Something THEN Next.Enabled := False


Jørgen Storlie


Thanks thats a good suggestion which gets me part of the way. I still have a problem though:

A: If user enters a valid number, then the Next.Enabled is set to True, which is great.

B: But then the user changes her mind and enters another number which is wrong.

The problem is that Next.Enabled stays set to True from step A. So the user is now allowed to continue with an invalid number.

I must ensure that an invalid number is not allowed to click Next. Any suggestions?

Posted: Fri Jun 22, 2007 12:45 am
by get101
Ira Rainey wrote:... then shell to a console app which validates the string entered. The result of which being captured and the installer allowed to carry on or gets sent back with a warning.


This sounds complicated. :oops:

Is this something that I can do step-by-step, or is it very technical?

My requirement is to validate a serial number against a list of 20 possibilities. If it is not one of those, then do not allow Next to be clicked.

Posted: Fri Jun 22, 2007 3:43 am
by Ira Rainey
Depends on your programming ability. It's pretty simple really. You write an app (for me I use VB.NET, but it could be pretty much anything) which takes in a string as a command line parameter which is the code you want to validate, then it just checks the string against a list of valid alternatives and returns a value representing the result.

This is called in IA by using run program:

Set Variable CODECHECK to -1
Set Variable TMPKEY to $KEY1$$KEY2$$KEY3$$KEY4$
Run Program $SUPPORTDIR$\\checkapp.exe $TMPKEY$ (WAIT)

if Variable CODECHECK Equals 0
MessageBox: Code Error
GoTo Label: Code Entry
end

Where CODECHECK is the variable the run program returns it's result in.

Posted: Sat Jun 30, 2007 1:25 am
by get101
Ira Rainey wrote:Depends on your programming ability. It's pretty simple really. You write an app (for me I use VB.NET, but it could be pretty much anything) which takes in a string as a command line parameter which is the code you want to validate, then it just checks the string against a list of valid alternatives and returns a value representing the result.

This is called in IA by using run program:

Set Variable CODECHECK to -1
Set Variable TMPKEY to $KEY1$$KEY2$$KEY3$$KEY4$
Run Program $SUPPORTDIR$\\checkapp.exe $TMPKEY$ (WAIT)

if Variable CODECHECK Equals 0
MessageBox: Code Error
GoTo Label: Code Entry
end

Where CODECHECK is the variable the run program returns it's result in.


As suggested, I have created the program checkapp.exe that is going to check my serial numbers. I do not know where to run this code - can you tell me where in the script this code can be added?

Posted: Sat Jun 30, 2007 6:45 am
by jimo
Put it immediately after you Registration dialog that retrieves the user input of the serial number.

If the value is NOT valid loop back to the appropriate dialog label:

Example:

Code: Select all

Label: License Check
Display Dialog: registrationwithserial, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
   GoTo Label: <Previous>
else
   if Variable WIZARD Equals CANCEL
     GoTo Label: Main Install
   end
end
Set Variable CODECHECK to -1
Set Variable TMPKEY to $KEY1$$KEY2$$KEY3$$KEY4$
Run Program $SUPPORTDIR$\\checkapp.exe $TMPKEY$ (WAIT)
if Variable CODECHECK Equals 0
    MessageBox: Code Error
    GoTo Label: License Check
end