cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
mjansonuk
Level 2

Edit Control Validation

Hello

I want to add validation to dialog box so that when user clicks 'Next' button it prevents them continuing if 'Edit1' (a control on the form) is blank.

I have added two actions to the Next button behaviour:

1. Run custom action (Installscript) to display a message box on condition Edit1 = ""
2. NewDialog if Edit1 <> ""

Action 1 works fine, but action 2 never seems to execute even when Edit1 is not blank, so usercannot move on to the next dialog box.

Any suggestions please?
Labels (1)
0 Kudos
(3) Replies
TsungH
Level 12

It will probably easier if you post screenshots of Edit control property sheet and Control Events on Next button. Also, a verbose installation log may shed some light on this problem.
0 Kudos
skolte
Level 7

Assuming that you already have your custom dialog setup the way you want and have the InstallScript code with a switch statement to respond to different events, here's how I would write the code for NEXT button's switch case.

 // case statement for NEXT button click in your dialog
case RES_PBUT_NEXT:
// Get the contents of the edit boxes.
// RES_EDITBOX is the control identifier for your Edit box,
// svEditText is a string to retrieve the input
CtrlGetText (szDialogName, RES_EDITBOX, svEditText);

// Verify that edit box has data.
if (StrLength(svEditText) = 0)) then
MessageBox ("Text field cannot be empty.", INFORMATION);
else
bDone = TRUE;
endif;
nResult = NEXT;
0 Kudos
mjansonuk
Level 2

Thanks for your responses, all works fine now 🙂
0 Kudos