November 16, 2011

How to Reset the Edit control value on CheckBox Action?

This article explains how to reset the Edit control value on CheckBox Action.

Assume you have two Edit controls named EDIT1 & EDIT2 and a Check Box named ChkBoxSkip.
OnClick on ChkBoxSkip, you may want to set null value or empty string to EDIT1 & EDIT2 and disable them. Technically you should be able to define SetProperty CustomActions and add them under ChkBoxSkip events. But due to current limitation in InstallShield, it does not work this way.

Workaround:
Create two additional Edit controls named EDIT1_1 & EDIT2_2 and disable them by default. The default value of ChkBoxSkip should be set to 1 and there is no need to create IS_SKIP_CHECKED property in the Property Manager.
The properties associated to these controls are defined in below table
Control
Property
EDIT1
USERNAME
EDIT2
EMAILID
EDIT1_1
DUMMY
EDIT2_2
DUMMY
ChkBoxSkip
IS_SKIP_CHECKED
Now you will have to display EDIT1 & EDIT2 controls when ChkBoxSkip is UNCHECKED and display EDIT1_1 & EDIT2_2 when ChkBoxSkip is CHECKED. To achieve this, set the following contions for each of the Edit Controls.
 
Control
Action
Condition
EDIT1
Hide
SKIP_CHECKED
Show
Not  SKIP_CHECKED 
Enable
Not  SKIP_CHECKED
EDIT2
Hide
SKIP_CHECKED
Show
Not  SKIP_CHECKED 
Enable
Not  SKIP_CHECKED
EDIT1_1
Hide
Not SKIP_CHECKED
Show
SKIP_CHECKED 
EDIT2_2
Hide
Not SKIP_CHECKED
Show
SKIP_CHECKED 
 











with this, from the user's perspective EDIT1 & EDIT2 will be enabled with ChkBoxSkip is UNCHECKED and disabled & cleared when ChkBoxSkip is CHECKED. But actually the Property associated with EDIT1 and EDIT2 can be reset by using SetProperty CA OnClick on Next button.

Note: Applies to Basic MSI Project and verified in InstallShield 2012.